int SetCtrlBitmap (int panelHandle, int controlID, int imageID, int bitmapID);
Sets a bitmap object image in a control. You can use this function to replace an existing image in a control, create a new image in a control, or delete an image in a control. To delete an image, call SetCtrlBitmap with 0 as the value for the bitmap ID.
You can use this function with bitmaps created with NewBitmapEx, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap.
For picture controls, you can use this function instead of DisplayImageFile.
For picture buttons, you can use this function instead of calling SetCtrlAttribute with the ATTR_IMAGE_FILE attribute.
For picture rings, you can use this function instead of ReplaceListItem. To add a new entry, first call InsertListItem with a NULL value and then call SetCtrlBitmap.
For graphs, you must first call PlotBitmap with a NULL filename. Then call SetCtrlBitmap.
When you use SetCtrlBitmap to change the bitmap object that is assigned to a tree control image index, LabWindows/CVI updates all of the tree control items that use that index.
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. |
imageID | integer | For picture rings, the zero-based index of an image in the ring. For graphs, the plot handle you obtain from PlotBitmap. For tree controls, the image index you obtain from AddTreeImage. For picture controls, picture buttons, and canvas controls, this parameter is ignored. For tab controls, the zero-based index of the tab page that contains the image. |
bitmapID | integer | ID of the bitmap object that contains the new image. Obtain the ID from NewBitmapEx, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap. A value of 0 indicates that there is no image. Use 0 as the bitmapID to delete an existing image. |
Name | Type | Description | ||||
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
|