码迷,mamicode.com
首页 > 其他好文 > 详细

delphi TreeView修改选中的节点的颜色和背景

时间:2014-08-01 10:33:01      阅读:651      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   strong   for   2014   

bubuko.com,布布扣
 
TreeView修改选中的节点的颜色和背景
 
  TCustomDrawTarget = (dtControl, dtItem, dtSubItem);
  TCustomDrawStage = (cdPrePaint, cdPostPaint, cdPreErase, cdPostErase);
  TCustomDrawState = set of (cdsSelected, cdsGrayed, cdsDisabled, cdsChecked,
    cdsFocused, cdsDefault, cdsHot, cdsMarked, cdsIndeterminate);



procedure TForm1.TreeView1CustomDrawItem(Sender: TCustomTreeView;
  Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
    if (cdsSelected in State) then
   begin
      with Sender.Canvas do
      begin
        Brush.Color :=clBlue;
        Font.Color :=clRed;
        Font.Size := 11;
        Font.Style:=[fsBold];
      end;
   end;
end;


如何画图片 节点的整行的
procedure TForm1.TreeView1AdvancedCustomDraw(Sender: TCustomTreeView;
const ARect: TRect; Stage: TCustomDrawStage; var DefaultDraw: Boolean);
procedure TForm1.TreeView1AdvancedCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage;
var PaintImages, DefaultDraw: Boolean);
 
procedure TForm1.TreeView1CustomDraw(Sender: TCustomTreeView;
const ARect: TRect; var DefaultDraw: Boolean);
 
procedure TForm1.TreeView2CustomDrawItem(Sender: TCustomTreeView;
  Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
 




delphi TreeView修改选中的节点的颜色和背景,布布扣,bubuko.com

delphi TreeView修改选中的节点的颜色和背景

标签:style   blog   http   color   os   strong   for   2014   

原文地址:http://www.cnblogs.com/xe2011/p/3884193.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!