DelphiFAQ Home Search:

How can I modify a TreeView item's height?

 

comments1 comments. Current rating: 5 stars (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 { 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!
Content-type: text/html

Comments:

2008-04-09, 04:19:08
anonymous  
rating
this tip is very usefull

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: