Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemLabel

Defines an item's label picture information.

C

HBITMAP WINAPI SftTree_GetItemLabel(HWND hwndCtl, int index);
BOOL WINAPI SftTree_SetItemLabel(HWND hwndCtl, int index, HBITMAP hBitmap);
HBITMAP WINAPI SftTreeSplit_GetItemLabel(HWND hwndCtl, int index);
BOOL WINAPI SftTreeSplit_SetItemLabel(HWND hwndCtl, int index, HBITMAP hBitmap);

C++

CBitmap* CSftTree::GetItemLabel(int index) const;
BOOL CSftTree::SetItemLabel(int index, int val = 0);
BOOL CSftTree::SetItemLabel(int index, const CBitmap& Bitmap);
CBitmap* CSftTreeSplit::GetItemLabel(int index) const;
BOOL CSftTreeSplit::SetItemLabel(int index, int val = 0);
BOOL CSftTreeSplit::SetItemLabel(int index, const CBitmap& Bitmap);

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the item for which the label picture is to be retrieved or set. This parameter may be -1 to register the label picture size and make the label picture area visible using SetItemLabel.

hBitmap, Bitmap

A bitmap handle or a reference to a CBitmap object to use as the label picture for the specified item. The top, left pixel of the bitmap must contain the image's background color. This color will be replaced by the actual window background color when the bitmap is displayed. If the index parameter is -1, this bitmap is only used to determine the bitmap size of all label pictures. This parameter may be NULL to remove an item's label picture or to stop displaying label pictures for all items (set index to -1).

val

The only allowable value is 0, which is used to remove the item's label picture.

Returns

GetItemLabel returns the bitmap used to draw the requested item's label picture, or NULL if the item doesn't have a defined label bitmap.

SetItemLabel returns TRUE if the function was successful, otherwise FALSE is returned.

Comments

The GetItemLabel and SetItemLabel functions define an item's label picture information.

Get/SetItemLabel can be used to define a label picture using a bitmap handle only. Get/SetItemLabelPicture can be used to define a label picture using a bitmap, icon or ImageList image.

In a fixed height tree control, all label pictures used for all items must be the same size. New pictures can be registered at any time, but all label pictures in use must be replaced by pictures of the new size.

In a variable height tree control, label pictures can be of varying sizes. The largest picture size must be registered using SetItemLabel.

If an item doesn't have a label picture, the space normally occupied by the label picture is left blank.

An item may have an associated label picture without the label picture area actually being visible. The label picture area doesn't become visible until the (largest) label picture size has been registered using SetItemLabel by setting index to -1.

The CBitmap* pointer returned by GetItemLabel may be temporary and should not be stored for later use.

The application retains ownership of the bitmaps and cannot delete the bitmaps until the tree control no longer uses the bitmaps (usually until the tree control is destroyed or the bitmaps are changed).

In a tree control using a virtual data source, SetItemLabel can only be used to register the label picture size, otherwise an error is returned. The LabelPicture member of the SFTTREE_ITEM structure is used instead.

See Also C/C++ API | Categories | Notifications