)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize TreeNodeAdv with gradient appearance in WinForms TreeViewAdv?

Platform: WinForms |
Control: TreeViewAdv |
Published Date: March 14, 2016 |
Last Revised Date: February 4, 2020

Customize the treenodeadv with gradient appearance

In 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                                 Add basestyle to TreeNodeAdv with image

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon