# AddTreeImage

int AddTreeImage (int panelHandle, int controlID, int bitmapID);

## Purpose

Adds an image to the tree control.

Returns the zero-based index of the new image in the image list of the tree control. Use this index to set the ATTR_IMAGE_INDEX and ATTR_COLLAPSED_IMAGE_INDEX of an item or the ATTR_EXPANDED_IMAGE_INDEX and ATTR_COLLAPSED_IMAGE_INDEX of the tree.

You can use this function with bitmaps created with NewBitmapEx, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap.

## Parameters

Input
Name | Type | Description
panelHandle | integer | Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID | integer | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
bitmapID | integer | ID of the bitmap object that contains the image. Obtain the ID from NewBitmapEx, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap.

## Return Value

Name | Type | Description
newImageIndex | integer | Returns the index of the new tree image. Use the index to specify the image index in subsequent function calls. Negative values indicate that an error occurred.
Code | Error Message String
xx | Image Index (Success)