Sign in to follow this  
Followers 0
Emiel Wieldraaijer

Changing the color of GUICtrlCreateProgress

6 posts in this topic

Hi All,

I want to change the color of GUICtrlCreateProgress

I've tried GUICtrlSetBkColor(-1, 0xff0000) and GUICtrlSetColor(-1, 0x00ff00)

but both appear to have no effect

Does anyone have a solution

i could also use DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) but it will change the complete appearance of the GUI

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites



I don't wanna suppose that you did not refer to the right VAR?

$bar = GUICtrlCreateProgress (10,10,200,20)
GUICtrlSetColor($bar,32250)

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

i could also use DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) but it will change the complete appearance of the GUI

Use SetWindowTheme to change theme of single control. Search forum for examples.

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

This will do the trick!!!

#include <GuiConstants.au3>
Global $XS_n

$Gui = GuiCreate("Test")
GUISetBkColor(0x0)

XPStyleToggle(1)
$RadioButton = GUICtrlCreateRadio("Text", 20, 40, 40)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$bar = GUICtrlCreateProgress (100,100,210,20)
GUICtrlSetColor($bar,32250)
XPStyleToggle(0)

GUISetState()

for $x = 1 to 100
    GUICtrlSetData($bar, $x)
    Sleep(100)
Next

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

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

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@Star2

-1 points to the $var used above it

@Siao

Thnx will take a look -> Thnx this will solve my problem

@Valuater

Thnx for the code explaination

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

@Valuater

and i see my problem and it's better explained with your example

when XPStyleToggle(1) i'm able to change the color of the progressbar and with XPStyleToggle(0) the color is changed back to it's defaults.. and i'm unable to change the color.. could it be a bug ???

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
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
Sign in to follow this  
Followers 0