DelphiFAQ Home Search:
General :: Windows :: Programming :: Windows with Delphi :: Windows Forms
Code snippets, Q+A around the Windows user interface. From a Delphi perspective, but usually applicable to other languages.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

How can I modify a TreeView item's height?


How can I modify a TreeView item's height?


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.

 procedure SetTreeViewItemHeight(aTreeView: TTreeView; iItemHeight: Word); 
 begin { SetTreeViewItemHeight } 
   aTreeView.Perform(TVM_SETITEMHEIGHT, iItemHeight, 0); 
 end; { SetTreeViewItemHeight } 
 procedure TForm1.Button1Click(Sender: TObject); 
 begin { TForm1.Button1Click } 
   SetTreeViewItemHeight(TreeView1, 30); 
 end; { TForm1.Button1Click } 
You don't like the formatting? Check out SourceCoder then!
Generated 0:03:12 on Mar 17, 2018