Linux Posted January 31, 2008 Share Posted January 31, 2008 Hi all! Is it possible to resize a progress bar? I searched all the forum and havent found any clue, the only work around i found is by deleting it, and then create it with the new dimension, set the value and color again. Please help me if you have any clue. Thank you in advance Here is an example of what i got, so you dont have to build a program, you can change this one and i will get your point. expandcollapse popup#include <GuiConstants.au3> $Gui = GuiCreate("Test") XPStyleToggle(1) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $bar = GUICtrlCreateProgress (150,100,200,20,$PBS_SMOOTH) $bar2 = GUICtrlCreateProgress (150,130,200,20,$PBS_SMOOTH) $Label = GUICtrlCreateLabel("T",50,100,70,20) $Label2 = GUICtrlCreateLabel("T",50,130,70,20) GUICtrlSetColor($bar,32250) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch $Max1 = Random(1000,2000,1) $Max2 = Random(1000,2000,1) $C = Random(1,$Max1,1) $C2 = Random(1,$max2,1) GUICtrlSetData($Label, $C & " / " & $Max1) GUICtrlSetData($Label2, $C2 & " / " & $Max2) GUICtrlDelete($bar2) GUICtrlDelete($bar) If $Max2 < $Max1 Then $bar2 = GUICtrlCreateProgress (150,130,200,20,$PBS_SMOOTH) $bar = GUICtrlCreateProgress (150,100,($Max1 * 200/$Max2),20,$PBS_SMOOTH) Else $bar2 = GUICtrlCreateProgress (150,130,($Max2 * 200/$Max1),20,$PBS_SMOOTH) $bar = GUICtrlCreateProgress (150,100,200,20,$PBS_SMOOTH) EndIf ; GUICtrlSetData($bar, $C * 100 / $Max1) GUICtrlSetData($bar2, $C2 * 100 / $Max2) Sleep(1500) 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 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 More sharing options...
smashly Posted January 31, 2008 Share Posted January 31, 2008 Hi, use GUICtrlSetPos() to resize your progress barsexpandcollapse popup#include <GuiConstants.au3> $Gui = GuiCreate("Test") XPStyleToggle(1) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $bar = GUICtrlCreateProgress (150,100,200,20,$PBS_SMOOTH) $bar2 = GUICtrlCreateProgress (150,130,200,20,$PBS_SMOOTH) $Label = GUICtrlCreateLabel("T",50,100,70,20) $Label2 = GUICtrlCreateLabel("T",50,130,70,20) GUICtrlSetColor($bar,32250) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch $Max1 = Random(1000,2000,1) $Max2 = Random(1000,2000,1) $C = Random(1,$Max1,1) $C2 = Random(1,$max2,1) GUICtrlSetData($Label, $C & " / " & $Max1) GUICtrlSetData($Label2, $C2 & " / " & $Max2) If $Max2 < $Max1 Then GUICtrlSetPos($bar2, 150,130, 200,20) GUICtrlSetPos($bar, 150,100, ($Max1 * 200/$Max2),20) Else GUICtrlSetPos($bar2, 150,130, ($Max2 * 200/$Max1),20) GUICtrlSetPos($bar, 150,100, 200,20) EndIf GUICtrlSetData($bar, $C * 100 / $Max1) GUICtrlSetData($bar2, $C2 * 100 / $Max2) Sleep(1500) 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 cheers Link to comment Share on other sites More sharing options...
Linux Posted February 1, 2008 Author Share Posted February 1, 2008 Thank you very much, you have been very helpfull. i think the moderator can lock the topic now! 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now