TreeView修改选中的节点的颜色和背景
TCustomDrawTarget = (dtControl, dtItem, dtSubItem);
TCustomDrawStage = (cdPrePaint, cdPostPaint, cdPreErase,
cdPostErase);
cdPostErase);
TCustomDrawState = set of (cdsSelected, cdsGrayed, cdsDisabled,
cdsChecked,
cdsChecked,
cdsFocused, cdsDefault, cdsHot, cdsMarked,
cdsIndeterminate);
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;
TCustomTreeView;
const ARect: TRect; Stage: TCustomDrawStage; var
DefaultDraw: Boolean);
DefaultDraw: Boolean);
procedure TForm1.TreeView1AdvancedCustomDrawItem(Sender:
TCustomTreeView;
TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; Stage:
TCustomDrawStage;
TCustomDrawStage;
var PaintImages, DefaultDraw:
Boolean);
Boolean);
procedure TForm1.TreeView1CustomDraw(Sender:
TCustomTreeView;
TCustomTreeView;
const ARect: TRect; var DefaultDraw:
Boolean);
Boolean);
procedure TForm1.TreeView2CustomDrawItem(Sender:
TCustomTreeView;
TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw:
Boolean);
Boolean);