[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?