devxlogo

Get or Set the height of TreeView nodes

Get or Set the height of TreeView nodes

In plain VB there is no way to determine or change the height of node elements in a TreeView control. All you need to accomplish both tasks, however, is send the right message to the control.

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _    hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _    lParam As Any) As LongPrivate Const TV_FIRST = &H1100Private Const TVM_SETITEMHEIGHT = (TV_FIRST + 27)Private Const TVM_GETITEMHEIGHT = (TV_FIRST + 28)' return the height of a TreeView's individual itemsNodeHeight = SendMessage(TreeView1.hWnd, TVM_GETITEMHEIGHT, 0, ByVal 0&)' set the height of a TreeView's individual items' use the value -1 to restore default heightSendMessage TreeView1.hWnd, TVM_SETITEMHEIGHT, newNodeHeight, ByVal 0&

devx-admin

Share the Post: