简体   繁体   中英

How to change color of radtreeview Telerik UI WinForms selenting and selected node

By Default RadTreeView SelectedNode BackColor is orange gradient, but I ned to change color i tryed with

RadTV_Menu_Principal.SelectedNode.BackColor = Color.DarkBlue;

But that send error message because SelectedNode is null, I need pre-configurate the colors. enter image description here

I found one solution, I had to create two events for my RadTreeView.

enter code here
    private void RadTV_Menu_Principal_NodeMouseEnter(object sender, RadTreeViewEventArgs e)
    {
        ///Paint Node when begining focus
        e.Node.BackColor = Color.LightSteelBlue;
        e.Node.GradientStyle = GradientStyles.Solid;
    }

    private void RadTV_Menu_Principal_NodeMouseLeave(object sender, RadTreeViewEventArgs e)
    {
        ///Return the initial color when leave focus
        e.Node.BackColor = SystemColors.Highlight;
    }

The correct way to achieve this is to edit the theme you are using using the Visual Style Builder tool.

The other approach is to use code to override the theme values .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM