[Need Help] Progressbar / Zufällige Anzeige

08/13/2011 19:07 SIEG.BERT#1
Hallo epvp,
ich würde gerne wissen wie man eine Progressbar erstellt die bei jedem neuen Knopdruck zufällig "lang" wird.
D.h. beim ersten mal erreicht die Progressbar ein Status von 14%, beim 2. mal 49%, beim 3. 11%, usw. Also immer Zufällig.

Danke für alle hilfreichen Antworten.

LG
08/13/2011 19:10 omer36#2
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 414, 111, 192, 124)
$Progress1 = GUICtrlCreateProgress(16, 16, 377, 25)
$Button1 = GUICtrlCreateButton("Button1", 152, 64, 105, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            GUICtrlSetData
($Progress1, Random(1, 100))
    EndSwitch
WEnd 
08/13/2011 19:13 Freddy​#3
Hier n ganz kleines beispiel es gaht besser:

PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 232, 91, 192, 124)
$Progress1 = GUICtrlCreateProgress(8, 8, 209, 33)
$Button1 = GUICtrlCreateButton("Button1", 72, 56, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)


While 
1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            GUICtrlSetData
($Progress1, Random(1, 100))
    EndSwitch
WEnd 
€: Sry omer war schneller
08/13/2011 19:19 SIEG.BERT#4
Danke,
und wie kann ich jetzt den Wert der Progressbar auslesen und z.B. in Label1 ausgeben.

LG
08/13/2011 19:27 omer36#5
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 85, 192, 124)
$Progress1 = GUICtrlCreateProgress(16, 16, 265, 17)
$Button1 = GUICtrlCreateButton("Button1", 56, 56, 89, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("", 168, 56, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            GUICtrlSetData
($Progress1, Random(1, 100))
    EndSwitch
    If 
GUICtrlRead($Progress1) <> GUICtrlRead($Label1) Then GUICtrlSetData($Label1, GUICtrlRead($Progress1))
WEnd