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 shows a checkbox at the front of each item.

Disable drag and drop operation on TreeView items.

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 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 shows thin lines that link the parent and its child items.

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 makes the item remain as selected even if the TreeView control loses focus.