Jump to content

how to set the text color of a stus bar ?


sylvanie
 Share

Recommended Posts

  • 1 year later...

Hello !

I have looking for a way to color the text of a statusbar, like _GUICtrlStatusBarSetBKColor for the Background, but i haven't found.

Is it possible actualy to do it ?

Thanks

I want to know too ...

Expo 2010 Shanghai China中国2010年上海世博会

Link to comment
Share on other sites

wow... straight from help

this does not work... but, even more it does not error for $CLR_MONEYGREEN (non declared)!!!...???

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

    Local $hGUI, $hStatus
    Local $aParts[3] = [75, 150, -1]
    
    ; Create GUI
    $hGUI = GUICreate("(Example 1) StatusBar Set BkColor", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    GUISetState()

    ; Set parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

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

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

8)

NEWHeader1.png

Link to comment
Share on other sites

wow... straight from help

this does not work... but, even more it does not error for $CLR_MONEYGREEN (non declared)!!!...???

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

    Local $hGUI, $hStatus
    Local $aParts[3] = [75, 150, -1]
    
    ; Create GUI
    $hGUI = GUICreate("(Example 1) StatusBar Set BkColor", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    GUISetState()

    ; Set parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

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

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

8)

Works for me. $CLR_MONEYGREEN is defined in Constants.au3

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Works for me. $CLR_MONEYGREEN is defined in Constants.au3

Maybe its Xp

This works...

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

Dim $XS_n

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

    Local $hGUI, $hStatus
    Local $aParts[3] = [75, 150, -1]
    
    ; Create GUI
    $hGUI = GUICreate("(Example 1) StatusBar Set BkColor", 400, 300)
    XPStyle()   
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    XPStyle(0)
    GUISetState()

    ; Set parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

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

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main



 Func XPStyle($OnOff = 1)   
    If $OnOff And StringInStr(@OSTYPE, "WIN32_NT") Then
        $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>XPStyle

8)

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...