How do I update the Collapse/Expand picture when expanding or collapsing a directory Node in TADVTreeView ?
Thanks in Advance...
How do I update the Collapse/Expand picture when expanding or collapsing a directory Node in TADVTreeView ?
Thanks in Advance...
To change the expand/collapse node icon, please use the following properties:
AdvTreeView1.NodesAppearance.ExpandNodeIcon;
AdvTreeView1.NodesAppearance.CollapseNodeIcon;
You can dynamically change the node icon as well, by overriding the default drawing through the OnBeforeDrawNodeExpand event.
procedure TForm1.AdvTreeView1BeforeDrawNodeExpand(Sender: TObject;
AGraphics: TAdvGraphics; ARect: TRectF; AColumn: Integer;
ANode: TAdvTreeViewVirtualNode; AExpand: TAdvBitmap; var AAllow: Boolean);
begin
end;
How do I assign an image (TADVBitmap) from a TPictureContainer ?
Do you mean
AdvTreeView1.NodesAppearance.ExpandNodeIcon := SomeTADVBitmap;
How do I assign a TBitmap to a TADVBitmap ??
You can use the following code to accomplish this
AdvTreeView1.NodesAppearance.ExpandNodeIcon.Assign(PictureContainer1.Items[0].Picture);
On attached image please note Open Folder and Closed Folder icons towards the bottom. How do I achieve this with TADVTreeView ?.
Have not tried the following because I don't know how to assign to TAdvtBitmap. Do I use a PictureContainer ? Do I use a bitmap ?
procedure TForm1.AdvTreeView1BeforeDrawNodeExpand(Sender: TObject;
AGraphics: TAdvGraphics; ARect: TRectF; AColumn: Integer;
ANode: TAdvTreeViewVirtualNode; AExpand: TAdvBitmap; var AAllow: Boolean);
begin
end;
with the following code:
procedure TForm14.AdvTreeView1BeforeDrawNodeExpand(Sender: TObject;
AGraphics: TAdvGraphics; ARect: TRectF; AColumn: Integer;
ANode: TAdvTreeViewVirtualNode; AExpand: TAdvBitmap; var AAllow: Boolean);
begin
AAllow := False;
AGraphics.PictureContainer := PictureContainer1;
AGraphics.DrawBitmapWithName(ARect, 'MyImage');
end;