DisplayImageFile
- Updated2023-02-21
- 2 minute(s) read
DisplayImageFile
int DisplayImageFile (int panelHandle, int controlID, char filename[]);
Purpose
Displays the contents of an image file on a picture control.
This function supports the following image types: .tif, .pcx, .bmp, .dib, .rle, .ico, .jpg, .png, .wmf, and .emf.
(Linux) This function supports the following image types: .pcx, .xwd, and .jpg.
To display an image, first create a picture control in the User Interface Editor or using NewCtrl. Then call DisplayImageFile using the control ID for that picture control.
To replace the current image with another image, call DisplayImageFile with the same control ID but a different image file.
To delete the image, call DeleteImage, which also removes the image from memory.
Supported Controls
You can use DisplayImageFile with picture 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. |
filename | char [] | Pathname of the file that contains the image. You can use a complete pathname or a simple filename. If the name is a simple filename, the file is loaded from the directory that contains the executable. |
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 3.0 and later
Example
Refer to userint\custctrl\ComboBox\combodemo.cws for an example of using the DisplayImageFile function.