Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
How can I modify a TreeView item's height?
1 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Question:
How can I modify a TreeView item's height?
Answer:
Simply send a message TVM_SETITEMHEIGHT to the treeview control. The first parameter (word parameter, aka 'wParm') specifies the new height of every item in the tree view, measured in pixels. Note these restrictions:
- this will affect all items in the treeview control
- heights less than 1 will be set to 1.
- if the height is not even and the tree-view control does not have the TVS_NONEVENHEIGHT style, this value will be rounded down to the nearest even value.
- if the height is -1, the control will revert to using its default item height.
 | |  | | uses
CommCtrl;
procedure SetTreeViewItemHeight(aTreeView: TTreeView; iItemHeight: Word);
begin
aTreeView.Perform(TVM_SETITEMHEIGHT, iItemHeight, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SetTreeViewItemHeight(TreeView1, 30);
end;
//.. | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|