Styles of Tree-View Control (Win32)

The styles of Tree-View control modifies the appearance and behaviours of a TreeView control. These styles are specified when you create a TreeView control, but these can be modified later by using SetWindowLong() with GWL_STYLE flag. You can also combine any window styles together.

TVS_CHECKBOXES
TVS_CHECKBOXES shows a checkbox at the front of each item.

TVS_DISABLEDRAGDROP
Disable drag and drop operation on TreeView items.

TVS_EDITLABELS
User can edit the text of each item if TVS_EDITLABELS is enabled. TreeView control will notify the parent window at the beginning and end of editing, TVN_BEGINLABELEDIT and TVN_ENDLABELEDIT.

TVS_HASBUTTONS
TVS_HASBUTTONS adds a button to the left side of a parent item. The user can click the button to expand or collapse the child items. In order to have this button on the root item, combine 3 styles: TVS_HASBUTTONS, TVS_HASLINES and TVS_LINESATROOT.

TVS_HASLINES
TVS_HASLINES shows thin lines that link the parent and its child items.

TVS_LINESATROOT
By default, TreeView does not draw lines from the root item, even if TVS_HASLINES is enabled. TVS_LINESATROOT enables the hierachy lines from the root item.

TVS_SHOWSELALWAYS
TVS_SHOWSELALWAYS makes the item remain as selected even if the TreeView control loses focus.

←Back