Function Reference


GUICtrlSetColor

Sets the text color of a control.

GUICtrlSetColor ( controlID, textcolor )

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate...() function, or -1 for the last created control.
textcolor The RGB color to use.

Return Value

Success: 1.
Failure: 0.

Remarks

Only Button, Label, Checkbox, Group, Radio, Edit, Input, List, Listview, ListviewItem, Treeview, TreeviewItem, Graphic, Progress and Combo controls can currently be colored.

Checkbox, Radio, Group or Progress controls cannot be painted if the "Windows XP/Vista style" is used. Such style can be force by calling _WinAPI_SetThemeAppProperties(0).

Button controls are always painted in "Windows Classic style".

Related

GUICtrlCreate..., GUICtrlSetBkColor, GUICtrlSetDefColor, _WinAPI_SetThemeAppProperties

Example

#include <ColorConstants.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
        ; Create a GUI with various controls.
        Local $hGUI = GUICreate("Example", 300, 200)

        ; Create a label control.
        Local $idLabel = GUICtrlCreateLabel("A string of text", 10, 10, 185, 17)
        Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25)

        ; Set the color of the label control.
        GUICtrlSetColor($idLabel, $COLOR_RED)

        ; Display the GUI.
        GUISetState(@SW_SHOW, $hGUI)

        ; Loop until the user exits.
        While 1
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE, $idButton_Close
                                ExitLoop

                EndSwitch
        WEnd

        ; Delete the previous GUI and all controls.
        GUIDelete($hGUI)
EndFunc   ;==>Example