windowsforms-120721-controls-and-libraries-tree-list-examples-nodes-how-to-enable-automatic-height-adjustment.md
Dec 15, 2018
2 minutes to read
The Tree list node height is set to match content height.
To disable automatic height adjustment, set the TreeList.OptionsBehavior.AutoNodeHeight (see TreeListOptionsBehavior.AutoNodeHeight) property to False.
In this mode, node height corresponds to the height of a single text line. Images are scaled to fit automatically calculated height.
To specify custom node height, disable automatic height adjustment, and specify the height using the TreeList.RowHeight property.
Once the custom node height has been set, text fields are properly centered, and images are scaled.
To customize node height, you can also handle the TreeList.CalcNodeHeight event, and specify the CalcNodeHeightEventArgs.NodeHeight event argument.
When automatic height adjustment is turned on, images are displayed using their original dimensions as specified in the database. If you delete an image, node height will be automatically adjusted.
To enable automatic height adjustment for cells with text data, select the column and use the TreeListColumn.ColumnEdit property to assign a new MemoEdit editor.
Ensure that the RepositoryItemMemoEdit.WordWrap property is set to true and then run the application. The Tree List adjusts the node height, so that the text is completely visible. If you add or remove the text, the height will be updated.
To specify custom height for images, assign a PictureEdit to the column. Use the editor’s RepositoryItemPictureEdit.CustomHeight property to specify the required value.
If you run the application, you will see that images are now truncated. The editor allows you to see the entire image by dragging it.
To shrink the images so that they fit the specified cell height, set RepositoryItemPictureEdit.SizeMode to PictureSizeMode.Zoom. Note that in this mode, the node keeps its height if you remove the image.
See Also
How to: Create custom nodes and specify height for individual nodes