Custom drawing methods for TreeView nodes in C #

Source: Internet
Author: User

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 #

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.