[Sv] - How to creat seperator between 2 areas?

Hi,
can i create any seperators like this?

also, i want to hide splitbutton border! how to do this?
Thanks you.

5 Replies 1 reply marked as answer

DV Duraimurugan Vedagiri Syncfusion Team June 22, 2020 09:04 AM UTC

Hi GridLock,

Thanks for contacting syncfusion support.

Query 1: Can I add a separator in splitbutton dropdown items.

Yes, you can add the separator to set the DropDownRenderer of the SplitButton control. Please refer the below code snippet.

public partial class Form1 : Form 
{ 
    SplitButton Splitbutton = new SplitButton(); 
    toolstripitem toolstripitem1 = new toolstripitem(); 
    toolstripitem toolstripitem2 = new toolstripitem(); 
    ToolStripSeparator toolStripSeparator1 = new CustomToolStripSeparator(); 
    public Form1() 
    { 
        InitializeComponent(); 
        Splitbutton.Size = new System.Drawing.Size(100, 50); 
        Splitbutton.Text = "SplitButton"; 
        toolstripitem1.Text = "Australia"; 
        toolstripitem2.Text = "Europe"; 
        Splitbutton.DropDownItems.Add(toolstripitem1); 
        Splitbutton.DropDownItems.Add(toolstripitem2); 
        Splitbutton.DropDownRenderer = new CustomRender(); 
        this.Controls.Add(Splitbutton); 
    } 
} 
 
public class CustomRender : ToolStripProfessionalRenderer 
{ 
    //To draw the dropdown of the item 
    protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) 
    { 
        e.Graphics.DrawString(e.Item.ToString(), e.TextFont, new SolidBrush(e.Item.ForeColor), e.TextRectangle.X, e.TextRectangle.Y); 
        e.Graphics.DrawLine(new Pen(Color.Red), e.TextRectangle.Left, e.TextRectangle.Bottom - 1, e.ToolStrip.Bounds.Right, e.TextRectangle.Bottom - 1); 
    } 
} 



Query 2: How to hide splitbutton border?

You can customize appearance of the SplitButton border using the ISplitButtonRenderer with DrawBorder method. Please refer the below documentation for your reference.

https://help.syncfusion.com/windowsforms/split-button/appearance-customization#customization-of-splitbutton

Regards,
Duraimurugan V

Marked as answer

TG The GridLock June 22, 2020 02:40 PM UTC

This is good news for me. Durai!,
 I will try it soon.


DV Duraimurugan Vedagiri Syncfusion Team June 23, 2020 04:11 AM UTC

Hi GridLock,

Thanks for your update.

We are looking forward to your confirmation. Please let us know if you need any further assistance.

Regards,
Duraimurugan


TG The GridLock June 23, 2020 04:15 PM UTC

Hi Durai, I have achieved this. thanks!


DV Duraimurugan Vedagiri Syncfusion Team June 24, 2020 07:57 AM UTC

Hi GridLock,

We are pleased to hear that the reported requirement is achieved at your end. Please get back to us if you need any other assistance.

Regards,
Duraimurugan V

Loader.
Up arrow icon