Farbige Progressbar

  • Hallo,
    es gibt ja eine UDF von Progandy um Progressbar zu färben.
    Das Problem ist nur bei mir sterben alle Scripte damit.
    Ok dachte ich mir, vll liegt es an meinem PC, schike das Tool an den Kumpel und tada dort stirbt es ebenfals.

    Kennt wer eine andere UDF um Progressbar zu färben ?

  • So?

    [autoit]

    GUICreate("Test", 120, 40)
    $hProgress = GUICtrlCreateProgress(10, 10, 100, 20, 0x01)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetColor(-1, 0xFF0000)
    GUISetState()

    [/autoit][autoit][/autoit][autoit]

    While GUIGetMsg() <> -3
    GUICtrlSetData($hProgress, Random(0, 100, 1))
    Sleep(10)
    WEnd

    [/autoit]

    E

  • Dafür gibts eine Funktion die ToggleXpStyle oder so ähnlich heißt.
    Ich kann sie leider nicht finden, wenn ich mich richtig erinnere war sie von Prog@ndy

    die hat aber sicher jemand archiviert


    EDIT: Gefunden

    [autoit]


    XPStyleToggle(1)
    GUICreate("Test", 120, 40)
    $hProgress = GUICtrlCreateProgress(10, 10, 100, 20, 0x01)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetColor(-1, 0xFF0000)
    XPStyleToggle(0)
    GUISetState()

    [/autoit][autoit][/autoit][autoit]

    While GUIGetMsg() <> -3
    GUICtrlSetData($hProgress, Random(0, 100, 1))
    Sleep(10)
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    Func XPStyleToggle($OnOff = 1)
    Local Static $XS_n
    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

    [/autoit]
  • Hallo freaky,

    hier einmal das etwas abgeänderte Beispiel aus der Hilfe:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    Example()

    [/autoit] [autoit][/autoit] [autoit]

    Func Example()
    Local $progressbar1, $progressbar2, $button, $wait, $s, $msg, $m

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("My GUI Progressbar", 220, 100, 100, 200)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) ; Classic-Style
    $progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
    GUICtrlSetColor(-1, 32250); not working with Windows XP Style
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) ; Standard-Windows-Style

    [/autoit] [autoit][/autoit] [autoit]

    $progressbar2 = GUICtrlCreateProgress(10, 40, 200, 20, $PBS_SMOOTH)
    $button = GUICtrlCreateButton("Start", 75, 70, 70, 20)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $wait = 20; wait 20ms for next progressstep
    $s = 0; progressbar-saveposition
    Do
    $msg = GUIGetMsg()
    If $msg = $button Then
    GUICtrlSetData($button, "Stop")
    For $i = $s To 100
    If GUICtrlRead($progressbar1) = 50 Then MsgBox(0, "Info", "The half is done...", 1)
    $m = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    If $m = -3 Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    If $m = $button Then
    GUICtrlSetData($button, "Next")
    $s = $i;save the current bar-position to $s
    ExitLoop
    Else
    $s = 0
    GUICtrlSetData($progressbar1, $i)
    GUICtrlSetData($progressbar2, (100 - $i))
    Sleep($wait)
    EndIf
    Next
    If $i > 100 Then
    ; $s=0
    GUICtrlSetData($button, "Start")
    EndIf
    EndIf
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>Example

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    mfg (Auto)Bert

  • Du musst das "Windows-klassisch"-Design einstellen, dann funktionierts!
    (ich hab winXP Home)

    Hier der Code (für eine pinke Progressbar):

    Spoiler anzeigen


    #include


    $ProgressBar = 0
    $Form1 = GUICreate("Farbige Progressbar", 302, 97, 192, 114)
    $Progress1 = GUICtrlCreateProgress(64, 32, 150, 18)
    GUICtrlSetColor(-1, 0xFF00FF) ; pink
    GUISetState(@SW_SHOW)

    AdlibRegister("UpdateProgressbar", 50)

    Func UpdateProgressbar()
    $ProgressBar = $ProgressBar + 1
    If $ProgressBar = 100 Then $ProgressBar = 1
    GUICtrlSetData($Progress1, $ProgressBar)
    EndFunc

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


    EDIT: bei #include fehlt noch <GUIConstantsEx.au3>, also #include <GUIConstantsEx.au3>

  • Hallo au3,

    $Progress1 = GUICtrlCreateProgress(64, 32, 150, 18)

    du solltest AutoIt-TAG's verwenden, dann passiert obiges nicht.

    Du musst das "Windows-klassisch"-Design einstellen, dann funktionierts!

    wie man das per Skript macht habe ich in Post #6 gezeigt. Dein Skript zeigt bei mir WinXP Prof (kein klassisches Design eingestellt) nicht [Edit]die neue Farbe nicht [/Edit], meines aber sehr wohl,

    mfg (Auto)Bert

    Einmal editiert, zuletzt von AutoBert (25. Mai 2010 um 19:40) aus folgendem Grund: Fotmatierung korrigiert