[DevExpress] sets the background color of FocusedNode and js sets the background color.

Source: Internet
Author: User

[DevExpress] sets the background color of FocusedNode and js sets the background color.

Key code:

/// <Summary> /// set the background color of the FocusedNode /// Description: // use this parameter in the CustomDrawNodeCell event // example: // _ curTree. setFocusedNodeBackColor (Color. green, Color. peachPuff, Color. black, e ); /// </summary> /// <param name = "tree"> TreeList </param> /// <param name = "backColor1"> Start background color </param> /// <param name = "backColor2"> end background color </param> /// <param name = "foreBrush"> font color </param> /// <param name = "e"> CustomDrawNodeCellEventArgs </param> public static void SetFocusedNodeBackColor (this TreeList tree, color backColor1, Color backColor2, Color foreBrush, CustomDrawNodeCellEventArgs e) {if (e. node = tree. focusedNode) {Brush _ backBrush, _ foreBrush; _ backBrush = new LinearGradientBrush (e. bounds, backColor1, backColor2, LinearGradientMode. horizontal); _ foreBrush = new SolidBrush (foreBrush); e. graphics. fillRectangle (_ backBrush, e. bounds); e. graphics. drawString (e. cellText, e. appearance. font, _ foreBrush, e. bounds, e. appearance. getStringFormat (); e. handled = true ;}}

Code usage:

        private void tlLHData_CustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e)        {            TreeList _curTree = sender as TreeList;            _curTree.SetFocusedNodeBackColor(Color.Orange, Color.PeachPuff, Color.Black, e);        }

Code effect:


How does the aspxtreeview control in DevExpress change the background color of the selected node?

The treeList control is used in DevExpress.
Change the selected node background
TreeList. OptionsBehavior. Editable = false;
TreeList. OptionsSelection. InvertSelection = true;
TreeList. Appearance. FocusedRow. BackColor = Color. Red;

In this way, you can achieve the desired effect !!!

For SimpleButton in DevExpress, after loading the background image, the left and top borders will show white lines.

It is estimated that the length and width of your background image are smaller than the minimum length and width of the BUTTON.
Try to enlarge the image

However, this image is meaningless. Cannot it be replaced by the background color?
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.