Custom Draw TreeView problem - Painted "+" got overriden
-
I am creating a custom draw treeview with level 0 treenodes draw by the code below. I want to paint the entire node row, including behind the PlusMinus button with a color of choice. The problem happens with my code running after the PlusMinus button is painted,thus erasing it. Is there some event fired before OnDrawNode painting the "+" that i am missing and should override? Setting a breakpoint on the begining of OnDrawNode and seeing the control, shows me the "+" is already painted. protected override void OnDrawNode(DrawTreeNodeEventArgs e){ if (e.Node.Level == 0){ Rectangle nodeRegion = new Rectangle(ClientRectangle.X, e.Node.Bounds.Y, ClientRectangle.Width, e.Node.Bounds.Height); SolidBrush nodeBackColor = new SolidBrush(Color.BlanchedAlmond); SolidBrush nodeForeColor = new SolidBrush(Color.Black); Font nodeFont = (e.Node.NodeFont == null) ? this.Font : e.Node.NodeFont; e.Graphics.FillRectangle(nodeBackColor, nodeRegion); // PROBLEM e.Graphics.DrawString(e.Node.Text.Trim(), nodeFont, nodeForeColor, e.Node.Bounds.Location); } else{ e.DrawDefault = true; } base.OnDrawNode(e); } ps.: It looks like the OnPaint event isnt fired on a TreeView. Couldnt find why is this on MSDN. Thanks! Diego Valdevino