Progress senkrecht ?

  • Hi ich wollte fragen ob es möglich ist einen Progress
    auch senkrecht zu erstellen.

    Mit

    [autoit]

    GUICtrlCreateProgress()

    [/autoit]

    Ist dieser ja Horizontal...

    MfG chicki

    Einmal editiert, zuletzt von chicki (14. Mai 2008 um 16:46)

    • Offizieller Beitrag

    Hi,

    standardmäßig glaube ich nicht, aber du kannst dir selbst eine zeichnen

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    Global $batterieFarbe = 0x555555, $sliderpos = 0
    $gui = GUICreate("Batterie", 130, 200, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
    $input = GUICtrlCreateInput("80", 50, 200 - 24 - 10, 30, 24, BitOR($ES_NUMBER, $ES_RIGHT))

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

    $label = GUICtrlCreateLabel("", 120, 50, 50, 100)
    GUICtrlSetBkColor($label, $batterieFarbe)

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

    GUICtrlCreateLabel("", 19, 49, 52, 102)
    GUICtrlSetBkColor(-1, $batterieFarbe)
    GUICtrlCreateLabel("", 40, 45, 10, 5)
    GUICtrlSetBkColor(-1, $batterieFarbe)

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

    $slider = GUICtrlCreateSlider(80, 40, 30, 120, BitOR($TBS_VERT, $TBS_LEFT, $TBS_AUTOTICKS))
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlSetData(-1, 20)

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

    _GetColorByValue(80)
    GUISetState(@SW_SHOW)

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

    While 1
    ;Damit es nicht über 100% werden..
    If StringLen(GUICtrlRead($input)) > 2 Then
    If Number(GUICtrlRead($input)) > 100 Then
    GUICtrlSetData($input, 100)
    SoundPlay(@WindowsDir & "\media\Windows XP-Ping.wav", 0) ;Fehlergeräusch
    EndIf
    EndIf
    If GUICtrlRead($slider) <> $sliderpos Then
    $sliderpos = GUICtrlRead($slider)
    GUICtrlDelete($label)
    $label = GUICtrlCreateLabel("", 20, 50 + 100 - (100 - GUICtrlRead($slider)), 50, (100 - GUICtrlRead($slider)))
    GUICtrlSetBkColor($label, _GetColorByValue(100 - GUICtrlRead($slider)))
    GUICtrlSetData($input, 100 - GUICtrlRead($slider))
    EndIf

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

    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    WEnd

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

    Func _GetColorByValue($iProzent)
    Local $hColor = 0
    If ($iProzent > 50) Then
    $hColor = "0x" & Hex((100 - $iProzent) * 5.1, 2) & "FF00"
    Else
    $hColor = "0xFF" & Hex(($iProzent) * 5.1, 2) & "00"
    EndIf
    Return $hColor
    EndFunc ;==>_GetColorByValue

    [/autoit]

    Mega

  • okay xD naja mit den labels ist es aber schöner ( 2farbig ) und nicht in segmente aufgeteilt !!!

    Jedoch blinkt es dafür etwas, was auch nciht gerade schön ist^^.
    Mit blinken meine ich das hier : ( hab das natürlich so angepasst wie ich es brauche )

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    Global $batterieFarbe = 0x555555, $lol = 0
    $gui = GUICreate("Batterie", 130, 200, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
    $input = GUICtrlCreateInput("", 50, 200 - 24 - 10, 30, 24, BitOR($ES_NUMBER, $ES_RIGHT))
    GUICtrlSetState(-1,$GUI_HIDE)

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

    $label = GUICtrlCreateLabel("", 20, 50, 10, 100)
    GUICtrlSetBkColor($label, $batterieFarbe)

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

    GUICtrlCreateLabel("", 19, 49, 12, 102)
    GUICtrlSetBkColor(-1, $batterieFarbe)

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

    _GetColorByValue(80)
    GUISetState(@SW_SHOW)

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

    While 1
    $Readinput = GUICtrlRead($input)
    Switch $Readinput
    Case 100
    For $i = 100 To 0 Step -1
    Sleep(10)
    If $i <> $lol Then
    $lol = $i
    GUICtrlDelete($label)
    $label = GUICtrlCreateLabel("", 20, 150 - 100 + (100 - $i), 10, (0 + $i))
    GUICtrlSetBkColor($label, _GetColorByValue(100 - $i))
    GUICtrlSetData($input, 100 - $i)
    GUICtrlSetData($input, "")
    EndIf

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

    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    Next
    Case 0
    For $i = 0 To 100
    Sleep(10)

    If $i <> $lol Then
    $lol = $i
    GUICtrlDelete($label)
    $label = GUICtrlCreateLabel("", 20, 150 - 100 + (100 - $i), 10, (0 + $i))
    GUICtrlSetBkColor($label, _GetColorByValue(100 - $i))
    GUICtrlSetData($input, 0 + $i)
    EndIf

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

    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    Next

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

    EndSwitch
    WEnd

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

    Func _GetColorByValue($iProzent)
    Local $hColor = 0
    If ($iProzent > 50) Then
    $hColor = "0x" & Hex((100 - $iProzent) * 5.1, 2) & "FF00"
    Else
    $hColor = "0xFF" & Hex(($iProzent) * 5.1, 2) & "00"
    EndIf
    Return $hColor
    EndFunc ;==>_GetColorByValue

    [/autoit]
  • Das wird doch nicht gehn, das Label muss ja wachsen bzw. schrumpfen!
    WEnn ich die Position verändere dann kann ich es nur verschieben.

    Falls ich falsch liege sagt es mit bitte^^

    chicki

  • mit folgender funktion bekommst du die segmente (xp-style) weg und kannst den progressbar einfärben:

    Spoiler anzeigen
    [autoit]

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

    [/autoit]

    z.b.:

    Spoiler anzeigen
    [autoit]

    XPStyleToggle(1)
    GUICtrlCreateProgress($X, $Y, $W, $H, $PBS_SMOOTH + $PBS_VERTICAL)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFF0000)
    XPStyleToggle(0)

    [/autoit]


    ps.: falls du labels benutzen willst: bei Guictrlsetpos kannst du auch die Breite/Höhe angeben, und die änderst du dann beim updaten der labels.

    lGE

  • Danke ich dachte man kann die Farbe des Progresses nicht ändern aber das liegt wohl am XP Style.
    Yetzt funzt es super und binkt uach nicht.

    PS: ne ich nehm dann doch keine Labels das ist zu umständlich. ( da hab ich mich wohl geirrt ich dachte
    man kann mit GUICtrlSetPos nur die Position verändern und nicht die "Maße" Big Thx

    chicki