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&

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist