Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemBitmap

Defines an item's item picture.

C

HBITMAP WINAPI SftTree_GetItemBitmap(HWND hwndCtl, int index);
BOOL WINAPI SftTree_SetItemBitmap(HWND hwndCtl, int index, HBITMAP hBitmap);
HBITMAP WINAPI SftTreeSplit_GetItemBitmap(HWND hwndCtl, int index);
BOOL WINAPI SftTreeSplit_SetItemBitmap(HWND hwndCtl, int index, HBITMAP hBitmap);

C++

CBitmap* CSftTree::GetItemBitmap(int index) const;
BOOL CSftTree::SetItemBitmap(int index, int val = 0);
BOOL CSftTree::SetItemBitmap(int index, const CBitmap& Bitmap);
CBitmap* CSftTreeSplit::GetItemBitmap(int index) const;
BOOL CSftTreeSplit::SetItemBitmap(int index, int val = 0);
BOOL CSftTreeSplit::SetItemBitmap(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 item picture is to be retrieved or set.

hBitmap, Bitmap

A bitmap handle or a reference to a CBitmap object to be used as item picture. 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. This parameter may be NULL to remove an item's item picture.

val

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

Returns

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

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

Comments

The GetItemBitmap and SetItemBitmap functions define an item's item picture.

Get/SetItemBitmap can be used to define an item picture using a bitmap handle only. Get/SetItemPicture can be used to define an item picture using a bitmap, icon or ImageList image.

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

In a variable height tree control, item pictures can be of varying sizes. The largest picture size must be registered using SetPictures. Item pictures defined using SetItemBitmap must be of equal or smaller size.

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

An item may have an associated item picture without the item picture area actually being visible. The item picture area doesn't become visible until the item picture size has been registered using SetPictures.

The CBitmap* pointer returned by GetItemBitmap may point to a temporary object 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, SetItemBitmap can only be used to register the picture size, otherwise an error is returned. The ItemPicture member of the SFTTREE_ITEM structure is used instead.

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