How to customize TreeNodeAdv with gradient appearance in WinForms TreeViewAdv?
Customize the treenodeadv with gradient appearance
In WinForms TreeViewAdv, TreeNodeAdv appearance can be customized with Gradient appearance by using the Class named “TreeNodeAdvStyleInfo”.
C#
TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1 = new TreeNodeAdvStyleInfo(); TreeNodeAdvStyleInfo treeNodeAdvStyleInfo2 = new TreeNodeAdvStyleInfo(); TreeNodeAdvStyleInfo treeNodeAdvStyleInfo3 = new TreeNodeAdvStyleInfo(); BrushInfoColorArrayList Brush1 = new BrushInfoColorArrayList(); Brush1.Add(Color.Yellow); Brush1.Add(Color.Gray); //To set the Back ground style for TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1.Background = new Syncfusion.Drawing.BrushInfo(GradientStyle.PathEllipse, Brush1); //To set the Back ground color for TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1.Background = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(Convert.ToByte(238), Convert.ToByte(122), Convert.ToByte(3))); //To set the Text color for TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1.TextColor = Color.WhiteSmoke; treeNodeAdvStyleInfo1.EnsureDefaultOptionedChild = true; //To add TreeNodeAdvStyleInfo into TreeViewAdv BaseStyle this.TreeViewAdv1.BaseStylePairs.AddRange(new Syncfusion.Windows.Forms.Tools.StyleNamePair[] { new Syncfusion.Windows.Forms.Tools.StyleNamePair("BaseStyle1", treeNodeAdvStyleInfo1), new Syncfusion.Windows.Forms.Tools.StyleNamePair("BaseStyle2", treeNodeAdvStyleInfo2), new Syncfusion.Windows.Forms.Tools.StyleNamePair("BaseStyle3", treeNodeAdvStyleInfo3) }); //To set the BaseStyle for TreeNodeAdv foreach (TreeNodeAdv tree in this.TreeViewAdv1.Nodes) { tree.BaseStyle = "BaseStyle1"; }
VB
Dim treeNodeAdvStyleInfo1 As New TreeNodeAdvStyleInfo() Dim treeNodeAdvStyleInfo2 As New TreeNodeAdvStyleInfo() Dim treeNodeAdvStyleInfo3 As New TreeNodeAdvStyleInfo() Dim Brush1 As New BrushInfoColorArrayList()Brush1.Add(Color.Yellow)Brush1.Add(Color.Gray)'To set the Back ground style for TreeNodeAdvStyleInfotreeNodeAdvStyleInfo1.Background = New Syncfusion.Drawing.BrushInfo(GradientStyle.PathEllipse, Brush1)'To set the Back ground color for TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1.Background = NewSyncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(CByte(238), CByte(122), CByte(3))) 'To set the Text color for TreeNodeAdvStyleInfo treeNodeAdvStyleInfo1.TextColor = Color.WhiteSmoke treeNodeAdvStyleInfo1.EnsureDefaultOptionedChild = True 'To add TreeNodeAdvStyleInfo into TreeViewAdv BaseStyle Me.TreeViewAdv1.BaseStylePairs.AddRange(New Syncfusion.Windows.Forms.Tools.StyleNamePair() {NewSyncfusion.Windows.Forms.Tools.StyleNamePair("BaseStyle1", treeNodeAdvStyleInfo1), NewSyncfusion.Windows.Forms.Tools.StyleNamePair("BaseStyle2", treeNodeAdvStyleInfo2), NewSyncfusion.Windows.Forms.Tools.StyleNamePair("BaseStyle3", treeNodeAdvStyleInfo3)}) 'To set the BaseStyle for TreeNodeAdv For Each tree As TreeNodeAdv In Me.TreeViewAdv1.Nodes tree.BaseStyle = "BaseStyle1" Next
Screenshot
Figure 1. Attach BaseStyle to TreeNodeAdv with Image.
Samples:
C#: How to attach BaseStyle to TreeNodeAdv C#
VB: How to attach BaseStyle to TreeNodeAdv VB
Conclusion
I hope you enjoyed learning about how to customize TreeNodeAdv with gradient appearance in WinForms TreeViewAdv.
You can refer to our WinForms TreeView’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms TreeView documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms TreeView and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!