Category / Section
How to customize the dropdown button appearance in WInForms SplitButton?
1 min read
Customize the dropdown button appearance
In WinForms SplitButton, you can customize the dropdown arrow appearance by using its function named DrawArrow.
C#
//Draws an arrow of the SplitButton public void DrawArrow(int left, int top, int width, int height, PaintEventArgs e, Color ArrowColor) { int StartPoint = left + 5; int EndPoint = StartPoint + width / 2; int HeightPoint = height; int TopPoint = height / 2 - 6; ArrowColorDefault = new SolidBrush(Color.Red); e.Graphics.FillPolygon(ArrowColorDefault, new Point[] { new Point(StartPoint, TopPoint ), new Point(StartPoint, TopPoint + 12 ), new Point(StartPoint + 7 , TopPoint + 6) }); }
VB
'Draws an arrow of the SplitButton Public Sub DrawArrow(ByVal left As Integer, ByVal top As Integer, ByVal width As Integer, ByVal height As Integer, ByVal e As PaintEventArgs, ByVal ArrowColor As Color) Implements ISplitButtonRenderer.DrawArrow Dim StartPoint As Integer = left + 5 Dim EndPoint As Integer = StartPoint + width \ 2 Dim HeightPoint As Integer = height Dim TopPoint As Integer = height \ 2 - 6 ArrowColorDefault = New SolidBrush(Color.Red) e.Graphics.FillPolygon(ArrowColorDefault, New Point() {New Point(StartPoint, TopPoint), New Point(StartPoint, TopPoint + 12), New Point(StartPoint + 7, TopPoint + 6)}) End Sub
Figure 1: Default arrow of the SplitButton
Figure 2: Custom arrow of the SplitButton
Samples:
C#: https://www.syncfusion.com/downloads/support/directtrac/139533/SplitButton_CustomArrow-427032526.zip
Reference link: https://help.syncfusion.com/windowsforms/split-button/appearance-customization