Function Reference


Sets the background color

#include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetBkColor ( $hWnd, $iColor )


$hWnd Handle to the control
$iColor New background color. Specify the CLR_DEFAULT value to cause the status bar to use its default background color.

Return Value

Returns the previous background color, or CLR_DEFAULT if the background color is the default color.


Returns RGB COLORREF color, color passed in must be BGR Hex color or RGB COLORREF

StatusBar controls cannot be painted if the "Windows XP style" is used. Some themes also prevent the statusbar from colouring - if the function appears not to work try removing the theme using _WinAPI_SetWindowTheme() with empty strings for the parameters.


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


Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("StatusBar Set BkColor (v" & @AutoItVersion & ")", 400, 300)
        Local $hStatus = _GUICtrlStatusBar_Create($hGUI)

        ; to allow the setting of Bk Color at least under Windows 10
        _WinAPI_SetWindowTheme($hStatus, "", "")

        ; Set parts
        Local $aParts[3] = [75, 150, -1]
        _GUICtrlStatusBar_SetParts($hStatus, $aParts)
        _GUICtrlStatusBar_SetText($hStatus, "Part 0")
        _GUICtrlStatusBar_SetText($hStatus, "Part 1", 1)
        _GUICtrlStatusBar_SetText($hStatus, "Part 2", 2)

        ; Set background color
        _GUICtrlStatusBar_SetBkColor($hStatus, $CLR_DARKSEAGREEN)

        ; Loop until the user exits.
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example