Admin Production ni-theme
Current Publication

GetCtrlBitmap

LabWindows/CVI

GetCtrlBitmap

int GetCtrlBitmap (int panelHandle, int controlID, int imageID, int *bitmapID);

Purpose

Obtains a bitmap image from a control and stores it in a bitmap object. You can pass the bitmap ID this function outputs to any function that accepts a bitmap, such as CanvasDrawBitmap or ClipboardPutBitmap.

You can use this function on images you create using functions such as DisplayImageFile, InsertListItem, PlotBitmap, SetImageBits, or SetCtrlAttribute with the ATTR_IMAGE_FILE attribute.

You can discard the bitmap object by passing its ID to DiscardBitmap.

Supported Controls

You can use GetCtrlBitmap with the following controls:

Parameters

Input
Name Type Description
panelHandle int Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel.
controlID int 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 functions such as NewCtrl and DuplicateCtrl.
imageID int 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.
Output
Name Type Description
bitmapID int ID that serves as a handle to the bitmap object.

You can pass the ID to functions that accept a bitmap, such as CanvasDrawBitmap and ClipboardPutBitmap.

To discard the bitmap, pass the ID to DiscardBitmap.

Zero is not a valid bitmap ID.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Examples

Refer to the following examples that use the GetCtrlBitmap function:

  • userint\canvas.cws

    Open example
  • userint\imagedit.cws

    Open example
  • userint\custctrl\toolbar\tooldemo.cws

    Open example