This example describes a custom drawing method for a TreeView node in C #. Share to everyone for your reference. Specific as follows:
if (E.state & treenodestates.selected)! = 0) {//Demo for Green Bottom White e.graphics.fillrectangle (Brushes.deepskyblue, E. Node.bounds); Font Nodefont = E.node.nodefont; if (Nodefont = = null) Nodefont = ((TreeView) sender). Font; E.graphics.drawstring (E.node.text, Nodefont, Brushes.white, Rectangle.inflate (e.bounds, 2, 0));} else{E.drawdefault = true;} if ((E.state & treenodestates.focused)! = 0) {using (Pen Focuspen = new Pen (color.black)) { Focuspen.dashstyle = S Ystem. Drawing.Drawing2D.DashStyle.Dot; Rectangle focusbounds = e.node.bounds; Focusbounds.size = new Size (focusbounds.width-1, focusbounds.height-1); E.graphics.drawrectangle (Focuspen, focusbounds); }}
I hope this article is helpful to everyone's C # programming.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
Custom drawing methods for TreeView nodes in C #
This address: http://www.paobuke.com/develop/c-develop/pbk23146.html
Related content example of C # simulation linked list data structure C # Implementation method of compiling JavaScript files into DLL files C # Implementation of a cookie based on WebBrowser get the vending machine interface via C #
C # Methods for modifying HTTP output using the IHttpModule interface method of conversion between list and array in C # in C # using recursive method for factorial implementation Enterprise Library for. NET Framework 2.0 Cache Usage Instance
Custom drawing methods for TreeView nodes in C #