標籤:hit 資料 orm sha border margin span 檔案的 ott
本文執行個體講述了C#中TreeView節點的自訂繪製方法。分享給大家供大家參考。具體如下:
if ((e.State & TreeNodeStates.Selected) != 0){ //示範為綠底白字 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 = System.Drawing.Drawing2D.DashStyle.Dot; Rectangle focusBounds = e.Node.Bounds; focusBounds.Size = new Size(focusBounds.Width - 1, focusBounds.Height - 1); e.Graphics.DrawRectangle(focusPen, focusBounds); }}
希望本文所述對大家的C#程式設計有所協助。
除聲明外,
跑步客文章均為原創,轉載請以連結形式標明本文地址
C#中TreeView節點的自訂繪製方法
本文地址: http://www.paobuke.com/develop/c-develop/pbk23146.html
相關內容C#類比鏈表資料結構的執行個體解析C#實現將javascript檔案編譯成dll檔案的方法C#基於WebBrowser擷取cookie的實現方法通過C#實現自動售貨機介面
C#使用IHttpModule介面修改http輸出的方法C#中List和數組之間轉換的方法C#採用遞迴實現階乘的方法Enterprise Library for .NET Framework 2.0緩衝使用執行個體
C#中TreeView節點的自訂繪製方法