Function Reference

GUICtrlCreatePic

Creates a Picture control for the GUI.

GUICtrlCreatePic ( filename, left, top [, width [, height [, style [, exStyle]]]] )

 

Parameters

filename filename of the icon to be loaded.
left The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width [optional] The width of the control (default is the previously used width).
height [optional] The height of the control (default is the previously used height).
style [optional] Defines the style of the control. See GUI Control Styles Appendix.

default (-1) : $SS_NOTIFY
forced style : $SS_BITMAP
exStyle [optional] Defines the extended style of the control. See Extended Style Table.

 

Return Value

Success: Returns the identifier (controlID) of the new control.
Failure: Returns 0.

 

Remarks

To set or change information in the control see GUICtrlSet....

To update the icon after the dialog box is displayed just use GUICtrlSetImage

If you want to have a picture having the same size as the file content just use width=height=0.

To have a transparent picture it is needed to use a .gif image with the transparency color set and to create the window with WS_EX_LAYERED extended style.

To add styles to default style just BitOr($GUI_SS_DEFAULT_PIC, newstyle,...).

 

Related

GUICoordMode (Option), GUICtrlSetImage, GUICtrlSet..., GUIGetMsg

 

Example


#include <GUIConstants.au3>
GUICreate("My GUI picture",350,300,-1,-1,$WS_SIZEBOX+$WS_SYSMENU)  ; will create a dialog box that when displayed is centered

GUISetBkColor (0xE0FFFF)
$n=GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",50,50, 200,50)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend


GUISetState ()
; resize the control
$n=GUICtrlSetPos($n,50,50,200,100)
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend