Function Reference

GUICtrlCreateLabel

Creates a static Label control for the GUI.

GUICtrlCreateLabel ( "text", left, top [, width [, height [, style [, exStyle]]]] )

 

Parameters

text The text of the control.
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) : none.
forced styles : $SS_NOTIFY, $SS_LEFT
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 combine styles with the default style use BitOr($GUI_SS_DEFAULT_LABEL, newstyle,...).

To use the values specified above you must #include <StaticConstants.au3> in your script.

Default resizing is $GUI_DOCKAUTO size and position will occur.

The extended style $GUI_WS_EX_PARENTDRAG can be used to allow the dragging of the parent window for windows that don't have a titlebar (no $WS_CAPTION style in GUICreate).

To set the background to transparent, use GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT).

 

Related

GUICoordMode (Option), GUICtrlSet..., GUIGetMsg

 

Example


#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $widthCell, $msg, $iOldOpt
   
    GUICreate("My GUI")  ; will create a dialog box that when displayed is centered

    GUISetHelp("notepad")  ; will run notepad if F1 is typed
    $iOldOpt = Opt("GUICoordMode", 2)

    $widthCell = 70
    GUICtrlCreateLabel("Line 1 Cell 1", 10, 30, $widthCell) ; first cell 70 width
    GUICtrlCreateLabel("Line 2 Cell 1", -1, 0) ; next line
    GUICtrlCreateLabel("Line 3 Cell 2", 0, 0) ; next line and next cell
    GUICtrlCreateLabel("Line 3 Cell 3", 0, -1) ; next cell same line
    GUICtrlCreateLabel("Line 4 Cell 1", -3 * $widthCell, 0) ; next line Cell1

    GUISetState()      ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    Do
        $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

    $iOldOpt = Opt("GUICoordMode", $iOldOpt)
EndFunc   ;==>Example