Jump to content

Change color of progress with GuiCtrlSetColor ?


Recommended Posts

I've tried to change progress color with GuiCtrlSetColor() and GuiCtrlSetBkColor() with no succes so I want to know if it's possible to change color without put image or another thing...

Thanks for anyhelp !

No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
Link to comment
Share on other sites

From the helpfile:

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

Checkbox, Radio or Progress controls cannot be painted if the "Windows XP style" is used.

Regards,Josh

Link to comment
Share on other sites

I've tried to change progress color with GuiCtrlSetColor() and GuiCtrlSetBkColor() with no succes so I want to know if it's possible to change color without put image or another thing...

Thanks for anyhelp !

Teehee

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 625, 445, 193, 125)
$Progress1 = GUICtrlCreateProgress(100, 100, 400, 50)
_GuiCtrlMakeTrans(-1, 80)
GUICtrlSetData(-1, 50)
$label1 = GUICtrlCreateLabel("", 100, 100, 200, 50)
GUICtrlSetState(-1, $GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


Func _GuiCtrlMakeTrans($iCtrlID,$iTrans=255)
    
    Local $pHwnd, $nHwnd, $aPos, $a
    
    $hWnd = GUICtrlGetHandle($iCtrlID);Get the control handle
    If $hWnd = 0 then Return SetError(1,1,0) 
    $pHwnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $hWnd);Get the parent Gui Handle
    If $pHwnd[0] = 0 then Return SetError(1,2,0)
    $aPos = ControlGetPos($pHwnd[0],"",$hWnd);Get the current pos of the control
    If @error then Return SetError(1,3,0)
    $nHwnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], 0x80000000, 0x00080000 + 0x00000040, $pHwnd[0]);greate a gui in the position of the control
    If $nHwnd = 0 then Return SetError(1,4,0)
    $a = DllCall("User32.dll", "hwnd", "SetParent", "hwnd", $hWnd, "hwnd", $nHwnd);change the parent of the control to the new gui
    If $a[0] = 0 then Return SetError(1,5,0)
    If NOT ControlMove($nHwnd,'',$hWnd,0,0) then Return SetError(1,6,-1);Move the control to 0,0 of the newly created child gui
    GUISetState(@SW_Show,$nHwnd);show the new child gui
    WinSetTrans($nHwnd,"",$iTrans);set the transparency
    If @error then Return SetError(1,7,0)
    GUISwitch($pHwnd[0]);switch back to the parent Gui
    
    Return $nHwnd;Return the handle for the new Child gui
    
EndFunc
Link to comment
Share on other sites

Hi!

I assume you are using windows XP.

Use this at the start of your script to enable colors in the progressbars.

; ==================== Function XPStyleToggle =============

; This function will disable the XP Style, so that Autoit can draw the progressbar in smooth, and with colors.

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 ;==>XPStyleToggle

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Link to comment
Share on other sites

Hi!

I assume you are using windows XP.

Use this at the start of your script to enable colors in the progressbars.

; ==================== Function XPStyleToggle =============

; This function will disable the XP Style, so that Autoit can draw the progressbar in smooth, and with colors.

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 ;==>XPStyleToggle

Thanks but how can I change color because progress are bleue and when I make GUICtrlSetColor(-1,0x000000) nothing happend its normal ?
No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
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...