How to separate background between two adjacent nodes in WinForms TreeViewAdv?
You can separate the background between two adjacent nodes in WinForms TreeViewAdv control by using BeforeNodePaint event. Refer the below code for your reference.
C#
treeViewAdv1.BeforeNodePaint += TreeViewAdv1_BeforeNodePaint1;
//Customize Background of Nodes
private void TreeViewAdv1_BeforeNodePaint1(object sender, TreeNodeAdvPaintEventArgs e)
{
LinearGradientBrush lBrush = new LinearGradientBrush(e.Node.Bounds, Color.LightGreen, Color.LightSeaGreen, LinearGradientMode.Horizontal);
e.Graphics.FillRectangle(lBrush, e.Node.Bounds);
e.Graphics.DrawRectangle(new Pen(Color.Red), e.Node.Bounds);
}VB.Net
AddHandler treeViewAdv1.BeforeNodePaint, AddressOf TreeViewAdv1_BeforeNodePaint1
'Customize Background of Nodes
Private Sub TreeViewAdv1_BeforeNodePaint1(ByVal sender As Object, ByVal e As TreeNodeAdvPaintEventArgs)
Dim lBrush As New LinearGradientBrush(e.Node.Bounds, Color.LightGreen, Color.LightSeaGreen, LinearGradientMode.Horizontal)
e.Graphics.FillRectangle(lBrush, e.Node.Bounds)
e.Graphics.DrawRectangle(New Pen(Color.Red), e.Node.Bounds)
End Sub
Conclusion
I hope you enjoyed learning about how to separate background between two adjacent nodes in WinForms TreeViewAdv.
You can refer to our WinForms TreeViewAdv feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms TreeViewAdv example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!