Modifying Tree View Item Appearance

Every tree view item has a current state that determines its appearance and features. You can retrieve and set this state by sending the TVM_GETITEM and TVM_SETITEM messages or by using the TreeView_GetItem and TreeView_SetItem macros. You set or retrieve the item state by using the state member of the TV_ITEM structure that you pass in the pItem parameter (lParam) to these messages and macros.

Windows CE supports the TVIS_EXPANDPARTIAL item state. This state indicates that a tree view item is partially expanded. This could happen if an error occurs during data retrieval and some of the child items cannot be retrieved from the data source. The tree view displays the items that were successfully retrieved, but continues to display the plus symbol next to the parent item as well. This indicates to a user that more information is available. When a user clicks the plus symbol again, the application repeats the query.

The following table shows item states supported by Windows CE.

State
Definition
TVIS_BOLD Windows CE uses a bold font to draw the item.
TVIS_CUT Windows CE selects the item for cutting and pasting.
TVIS_DROPHILITED Windows CE selects the item for a drag-and-drop operation.
TVIS_EXPANDED Windows CE expands the items list of child items so that the child items are visible. This state applies only to parent items.
TVIS_EXPANDEDONCE Windows CE expands the item's list of child items at least once. Windows CE does not send the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notifications for parent items that have specified this value. This value applies only to parent items.
TVIS_EXPANDPARTIAL Windows CE partially expands the items. This could happen if an error occurs during data retrieval and some of the child items cannot be retrieved from the data source.
TVIS_FOCUSED Windows CE gives the item the focus and surrounds it with a standard focus rectangle. Although more than one item can be selected, only one item can have the focus.
TVIS_OVERLAYMASK Windows CE includes the item's overlay image when it draws the image. The index of the overlay image must be specified in the state member of the TV_ITEM structure by using the INDEXTOOVERLAYMASK macro. The overlay image must be added to the tree view's image list by using the ImageList_SetOverlayImage function. This value should not be combined with any other value.
TVIS_SELECTED Windows CE selects the item. The appearance of a selected item depends on whether it has the focus and on whether the system colors are used for selection.
TVIS_STATEIMAGEMASK Windows CE includes the item's state image when it draws the item. The index of the state image must be specified in the state member of the TV_ITEM structure by using the INDEXTOSTATEIMAGEMASK macro. This value should not be combined with any other value.