Shiny Language Reference
Language Reference > User Interface > Static Images
createstaticimage
int createstaticimage(int ID, int X, int Y, int Width, int Height[, string File]);
int createstaticimage(int ID, int X, int Y, string File);
Creates a static image control in the display panel
The CREATESTATICIMAGE statement creates a user interface image control in the plugin display panel. Static image controls within Brass work exactly the same as static controls in Windows. Refer to the Static Image index for a detailed explanation on the difference between a static image control and using drawimage.
Every user interface element is assigned a "control ID". This ID uniquely references an individual control and is the method by which you access and manage the control.
CREATESTATICIMAGE is the only statement you must call to create a working image control in the display panel. The remaining statements are provided for extra functionality and ease of use, however they are not mandatory.
Unlike Windows, Brass allows controls to be stacked on top of each other. Controls are ordered visually in the same order that they are created. Therefore to display smaller image control A on top of larger button B, create B before A.
When the second form of CREATESTATICIMAGE is used (the prototype that does not include a Width and Height parameter), Brass automatically sizes the control to match the image in the specified file.
When the first form of CREATESTATICIMAGE is used but no filename is specified, Brass creates a blank image control. This control can then be used like a canvas for drawing on using the custom draw system. The advantage to this is it allows you to draw complex images as the plugin runs (rather than stored on disk as a pre-created image), and the resulting image is used for your static control. This in turn is enabled for the 100% Configuration System, meaning that all of your custom drawing is moveable and resizable simply by clicking on the display panel when Design Mode is enabled.
Parameters
ID
Your preferred control ID for this control. You may specify any positive (greater than 0) integer for a control ID. If you specify a control ID that is already in use, the CREATESTATICIMAGE statement will return a new, unique ID for this control. Therefore you should assume that any value supplied for this parameter is only a suggestion, and the return value is the absolute control ID. You may specify integer 1 for every call to this statement, which will cause CREATESTATICIMAGE to return sequential control IDs for you, removing the need to store the last used control ID.
X
The X pixel position within the display panel of the top left of the control
Y
The Y pixel position within the display panel of the top left of the control
Width
The width in pixels of the control. If the File parameter is specified, and the width of the image contained in that file is greater than the width specified here, the image will be clipped. In other words, this parameter specifies the maximum width of the control.
Height
The height in pixels of the control. If the File parameter is specified, and the height of the image contained in that file is greater than the height specified here, the image will be clipped. In other words, this parameter specifies the maximum width of the control.
File
The full path and filename to an image to load into this control. If you do not specify this parameter the static image control will be created as a blank control and will effectively be invisible, therefore you should use the custom draw system to draw into your control. Allowed formats include: JPG, GIF (including transparency), BMP, WMF, EMF, PNG (including per-pixel transparency).
Return Value
The actual control ID assigned to this control.
Example Code
// Load c:\source.png (note escaped backslash) into the static image
// control, and position the control at X:10, Y:1. The control will
// be automatically sized to the dimensions of source.png
int FirstImageID = createstaticimage(1, 10, 1, "c:\\source.png");