Text auf Progressbar

  • Hi,

    kann mir einer Sagen wie ich auf eine Progrssbar einen Text zusätzliche einfügen kann. Also die Progressbar soll sich füllen und dabei soll noch als Text auf der Progressbar der aktuelle Füllstand in Prozent angezeigt werden.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

    Einmal editiert, zuletzt von chip (5. Oktober 2009 um 12:37)

    • Offizieller Beitrag

    Einfach transparent ein Label über die Progressbar legen:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Timers.au3>
    Global $iPercent, $iCount = 1
    $hGui = GUICreate('Test', 400, 300)
    $hProgress = GUICtrlCreateProgress(10, 10, 380, 20)
    $hLabel = GUICtrlCreateLabel('0%', 160, 13, 100, 16)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUISetState()
    $iTimer = _Timer_SetTimer($hGui, 50, '_Counter')
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    _Timer_KillTimer($hGui, $iTimer)

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

    Func _Counter($hWnd, $Msg, $iIDTimer, $dwTime)
    $iPercent += $iCount
    GUICtrlSetData($hLabel, $iPercent & '%')
    GUICtrlSetData($hProgress, $iPercent)
    If $iPercent = 100 Or $iPercent = 0 Then $iCount = -$iCount
    EndFunc

    [/autoit]
  • Manchmal ist es doch einfach als man denk. Dankesehr :).

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.