首页 > 代码库 > delphi TreeView修改选中的节点的颜色和背景
delphi TreeView修改选中的节点的颜色和背景
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;
如何画图片 节点的整行的
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);
来自为知笔记(Wiz)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。