Jump to content

Help to change the size of Progress window


Borje
 Share

Recommended Posts

Here is example:

#include <GUIConstants.au3>

GUICreate(StringTrimRight(@ScriptName,4),220,100, -1,-1, $WS_CAPTION, $WS_EX_TOPMOST)
;GUICreate(StringTrimRight(@ScriptName,4),220,100, -1,-1, $WS_MINIMIZEBOX + $WS_GROUP + $WS_CAPTION + $WS_POPUP + $WS_SYSMENU, $WS_EX_TOPMOST)
;GUICreate(StringTrimRight(@ScriptName,4),220,100, -1,-1, -1, $WS_EX_TOPMOST)
;GUISetBkColor (0xE0FFFF)

$progressbar = GUICtrlCreateProgress (10,15,200,20,$PBS_SMOOTH)
$procent = GUICtrlCreateLabel ('0 %', 10,40,200,20,$SS_CENTER)
$stop = GUICtrlCreateButton ("Stop",75,68,70,22,$BS_DEFPUSHBUTTON)

GUISetState()

$i = 0
While 1
  $msg = GUIGetMsg()

  If $msg = $stop OR $msg = $GUI_EVENT_CLOSE Then ExitLoop

  $i = $i + 1
  If $i > 100 Then $i = 0

  GUICtrlSetData ($progressbar,$i)
  GUICtrlSetData ($procent,$i & ' %')

  Sleep(100)
Wend
Link to comment
Share on other sites

GuiCreate('Progress', 500, 110);Make a window that is 500 pixels by 110 pixels

$label = GuiCtrlCreateLabel('Testing progress bar...', 10, 10, 200, 20);Create a simple label

$progress = GuiCtrlCreateProgress(100, 30, 300, 30) 

$btnTestProgress = GuiCtrlCreateButton('Test Progress', 200, 70, 100, 30)

GuiSetState();Show the GUI that we have created

While 1 
    Switch GuiGetMsg()
        Case -3;If exit was clicked
            Exit 
        Case $btnTestProgress;If the button was pressed
            GuiCtrlSetData($label, 'Starting progress...');Set the data of the label
            For $a = 1 to 100;Loop 100 times
                GuiCtrlSetData($progress, $a);Set the data with the current value of $a 
                Sleep(15);Sleep a little bit so the user can see the progress go up
                If $a = 50 then GuiCtrlSetData($label, 'Half way done...');Set the label at half way done
            Next 
            GuiCtrlSetData($label, 'All done')
    EndSwitch 
WEnd

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
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...