Rediger

Del via


Tree-View Control Extended Styles

This section lists extended styles used when creating tree-view controls. The value of extended styles is a bitwise combination of these styles.

Constant Description
TVS_EX_AUTOHSCROLL
Windows Vista. Remove the horizontal scroll bar and auto-scroll depending on mouse position.
TVS_EX_DIMMEDCHECKBOXES
Windows Vista. Adds a checkbox on the leftmost side of a given item that contains an icon of a dimmed check mark, that can indicate that a node is selected because its parent is selected. This includes a dimmed checkbox state in addition to 2 normal checkbox states. Do not use it at the same time as the TVS_CHECKBOXES style. See note below.
TVS_EX_DOUBLEBUFFER
Windows Vista. Specifies how the background is erased or filled.
TVS_EX_DRAWIMAGEASYNC
Windows Vista. Retrieves calendar grid information.
TVS_EX_EXCLUSIONCHECKBOXES
Windows Vista. Adds a checkbox icon on the leftmost side of a given item that contains a red X. This includes an exclusion checkbox state in addition to 2 normal checkbox states. Do not use it at the same time as the TVS_CHECKBOXES style. See note below.
TVS_EX_FADEINOUTEXPANDOS
Windows Vista. Fade expando buttons in or out when the mouse moves away or into a state of hovering over the control.
TVS_EX_MULTISELECT
Not supported. Do not use.
TVS_EX_NOINDENTSTATE
Windows Vista. Do not indent the tree view for the expando buttons.
TVS_EX_NOSINGLECOLLAPSE
Windows Vista. Intended for internal use; not recommended for use in applications. Do not collapse the previously selected tree-view item unless it has the same parent as the new selection. This style must be used with the TVS_SINGLEEXPAND style.
Note: This style may not be supported in future versions of Comctl32.dll. Also, this style is not defined in commctrl.h. Add the following definition to the source files of your application to use this style: #define TVS_EX_NOSINGLECOLLAPSE 0x0001
TVS_EX_PARTIALCHECKBOXES
Windows Vista. Adds a checkbox icon on the leftmost side of a given item with a square in the center, that can indicate that the node is partially selected. This includes a partial checkbox state in addition to 2 normal checkbox states. Do not use it at the same time as the TVS_CHECKBOXES style. See note below.
TVS_EX_RICHTOOLTIP
Windows Vista. Allow rich tooltips in the tree view (custom drawn with icon and text).

Note on using extended checkbox styles

The tree-view control has a very specific behavior for the checkbox styles. When a specific style or 'EX'-style combination is activated, the control keeps it to the end of its life (which means that you cannot modify the first checkbox style during the life of tree-view control).

To create a tree-view control with any extended checkbox styles, you must initially create the control window without the TVS_CHECKBOXES style and add (after creation) the chosen extended checkbox style by sending the TVM_SETEXTENDEDSTYLE message or by using the TreeView_SetExtendedStyle macro. The extended checkbox style can be any OR combination of TVS_EX_DIMMEDCHECKBOXES, TVS_EX_EXCLUSIONCHECKBOXES, or TVS_EX_PARTIALCHECKBOXES style.

The new tree-view control will provide the 2 normal checkbox states (checked and unchecked) plus 1 to 3 additional states (function of the chosen extended style). The normal states are always coded as 0x1000 and 0x2000, and any additional states are coded with the next values (0x3000, 0x4000, 0x5000). Use TVIS_STATEIMAGEMASK constant (0xF000) as the mask to get or set these states to/from the TVITEM structure.

Requirements

Requirement Value
Header
CommCtrl.h