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
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
Hi,
standardmäßig glaube ich nicht, aber du kannst dir selbst eine zeichnen
#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))
$label = GUICtrlCreateLabel("", 120, 50, 50, 100)
GUICtrlSetBkColor($label, $batterieFarbe)
GUICtrlCreateLabel("", 19, 49, 52, 102)
GUICtrlSetBkColor(-1, $batterieFarbe)
GUICtrlCreateLabel("", 40, 45, 10, 5)
GUICtrlSetBkColor(-1, $batterieFarbe)
$slider = GUICtrlCreateSlider(80, 40, 30, 120, BitOR($TBS_VERT, $TBS_LEFT, $TBS_AUTOTICKS))
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetData(-1, 20)
_GetColorByValue(80)
GUISetState(@SW_SHOW)
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
If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd
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
Mega
Danke für deine schnelle Hilfe
chicki
Äh...Progress geht doch auch Vertical:
[autoit]
#include<GUIConstants.au3>
GUICreate(640, 480)
GUICtrlCreateProgress(50, 10, 30, 200, $PBS_VERTICAL)
GUICtrlSetData(-1, 60)
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Oh danke Oscar, da hatte ich wohl einen kleinen ... :wacko:
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 )
#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)
$label = GUICtrlCreateLabel("", 20, 50, 10, 100)
GUICtrlSetBkColor($label, $batterieFarbe)
GUICtrlCreateLabel("", 19, 49, 12, 102)
GUICtrlSetBkColor(-1, $batterieFarbe)
_GetColorByValue(80)
GUISetState(@SW_SHOW)
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
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
If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
Next
EndSwitch
WEnd
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
Hi,
versuch mal das Label nicht immer neu zu erzeugen, sondern nur die Position zu ändern.
Mega
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:
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
z.b.:
XPStyleToggle(1)
GUICtrlCreateProgress($X, $Y, $W, $H, $PBS_SMOOTH + $PBS_VERTICAL)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFF0000)
XPStyleToggle(0)
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
Hier habe ich auch noch ein paar Beispiele für selbsterstellte ProgressBars.
Gefunden: Hier -> http://autoitscript.fr/forum/viewtopic.php?p=5121#p5121
Gruß
Greenhorn