Page 1 of 2
candyprogress - Fortschritt einmal anders...
Posted: 10 Apr 2021, 08:28
by moefr01
Liebe AHK-Gemeinde,
um das pandemische Leben einmal etwas b
unter zu machen, habe ich mich ein wenig mit dem
progress-control beschäftigt und diese "
aufgehübschte" Alternative gebastelt. Mein Interesse galt auch der Implementierung einer Icon-Bibliothek (
cpIcons.icl) in Bezug auf das Picture-Control eines GUI. Überraschend was sich mit den "native codes" so alles umsetzen lässt
.
Funktionsweise: Darstellung eines
progress-controls mit "überlagernden"
pics links und
rechts über dem Standard-progress-control und einem halbtransparenten pic in der Mitte, welches nur in der Länge angepasst werden kann. Anstelle dieser Icons (cpL, cpM, cpR) innerhalb der Bibliothek
cpIcons.icl kann man auch eigene
png-Dateien verwenden und somit eigene Dimensionen gestalten. Mit dem GuiControl-Befehl lassen sich die Farben einfach ändern. Wichtig ist auch die "doublebufferd GUI" mit +E0x02080000, sie ermöglicht erst das Ganze ruckelfrei und "overlayed"... beachtet bitte die umgekehrte Reihenfolge der hinzugefügten controls!
- Vorschau
- candyprogress.gif (110.36 KiB) Viewed 5275 times
Code: Select all
Gui, -DPIScale +E0x02080000 ;doublebuffered GUI
Gui, Color, FFCC00 ;GUI windowcolor (see edge of left & right part)
Gui, Add, Text, x20 y24 w436 h20 vCandyText cFFFFFF BackgroundTrans Center
Gui, Add, Pic, x20 y20 w18 h36 BackgroundTrans Icon1, cpIcons.icl ;left part
Gui, Add, Pic, x+ y20 w400 h36 BackgroundTrans Icon2, cpIcons.icl ;middle part
Gui, Add, Pic, x+ y20 w18 h36 BackgroundTrans Icon3, cpIcons.icl ;right part
Gui, Add, Progress, x20 y20 w436 h36 vCandyProgress
Gui, Show, x500 y500 w476 h76, CandyProgress
value = 0
Loop {
if (value >= 33) and (value <= 66)
color = FF00FF ;purple
else if value >= 66
color = 00A0FF ;aqua
else
color = 000000 ;black
GuiControl, +c%color%, CandyProgress ;set progress color
GuiControl, , CandyProgress, % value ;set progress value
GuiControl, , CandyText, % value "%" ;set progress text %
value += 1
if value > 100
{
Sleep, 2000
value = 0
}
Sleep, 100
}
Return
GuiEscape:
GuiClose:
ExitApp
Viel Spaß
moefr01
Re: candyprogress - Fortschritt einmal anders...
Posted: 10 Apr 2021, 11:51
by BoBo
Schaut mal richtig gut aus. R-E-S-P-E-K-T + vielen Dank fürs 'sharen'
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 02:47
by Frosti
Die Progressbars werden immer schöner. Ich kann mich kaum noch entscheiden!
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 03:57
by moefr01
Hallo liebe AHK-Coder,
anbei die erweiterte Version für vertikalen Fortschritt (positiv / negativ)...
.
Die cpIcons.icl habe ich um 3 Icons erweitert (pgT, pgV, pgT).
- Vorschau
- candyprogress.gif (512.78 KiB) Viewed 5198 times
Code: Select all
Gui, -DPIScale +E0x02080000 ;doublebuffered GUI
Gui, Color, FFCC00 ;GUI windowcolor (see edge of left & right part)
Gui, Add, Text, x20 y24 w436 h20 vCandyText cFFFFFF BackgroundTrans Center
Gui, Add, Text, x20 y170 w36 h48 vCandyTextV cFFFFFF BackgroundTrans Center
Gui, Add, Pic, x20 y20 w18 h36 BackgroundTrans Icon1, cpIcons.icl ;left part
Gui, Add, Pic, x+ y20 w400 h36 BackgroundTrans Icon2, cpIcons.icl ;middle part
Gui, Add, Pic, x+ y20 w18 h36 BackgroundTrans Icon3, cpIcons.icl ;right part
Gui, Add, Progress, x20 y20 w436 h36 vCandyProgress ;-Smooth = deactivates colorizing!
Gui, Add, Pic, x20 y70 w36 h18 BackgroundTrans Icon4, cpIcons.icl ;top part
Gui, Add, Pic, x20 y+ w36 h200 BackgroundTrans Icon5, cpIcons.icl ;vertical middle part
Gui, Add, Pic, x20 y+ w36 h18 BackgroundTrans Icon6, cpIcons.icl ;bottom part
Gui, Add, Progress, x20 y70 w36 h236 vCandyProgressV vertical ;-Smooth = deactivates colorizing!
Gui, Show, x500 y500 w476 h320, CandyProgress
value = 0
Loop {
if (value >= 33) and (value <= 66)
color = FF00FF ;purple
else if value >= 66
color = 00A0FF ;aqua
else
color = 000000 ;black
GuiControl, +c%color%, CandyProgress ;set progress color
GuiControl, , CandyProgress, % abs(value) ;set progress value
GuiControl, , CandyText, % abs(value) "%" ;set progress text %
GuiControl, +c%color%, CandyProgressV ;set vertical progress color
GuiControl, , CandyProgressV, % abs(value) ;set vertical progress value
GuiControl, , CandyTextV, % abs(value) "`n%" ;set vertical progress text %
value += 1
if value > 100
{
Sleep, 2000
value = -100-value
}
Sleep, 50
}
Return
GuiEscape:
GuiClose:
ExitApp
cheers... moefr01
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 04:35
by just me
Moin,
ein interessantes Konzept mit sehr gelungenem Ergebnis.
Danke!
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 05:21
by Frosti
Kannst Du das auch in Form einer sich füllenden Bierflasche darstellen?
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 06:40
by Johnny R
Hübsches Ding. Aber wie steuert man das Teil?
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 11:19
by moefr01
Frosti wrote: ↑11 Apr 2021, 05:21
Kannst Du das auch in Form einer sich füllenden Bierflasche darstellen?
Geht auch 'ne Flasche Himbeersaft?
- bottleprogress.gif (110.29 KiB) Viewed 5133 times
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 11:43
by moefr01
Johnny R wrote: ↑11 Apr 2021, 06:40
Hübsches Ding. Aber wie steuert man das Teil?
Eigentlich wie das
Standard-Progress-Control mit seinen
x y w h vertical - Parametern. Zu beachten ist lediglich die zusätzliche Angabe der
Picture-Controls im Randbereich des Fortschrittbalkens: beim
horizontalem Forschritt beginnt man das
linke picture an der x-Anfangsposition, dann das
mittlere und schließlich das
rechte zu setzen. Quasi überdecken diese 3 pictures dann das eigentliche Standard-Progress-Control. Beim
vertikalem Fortschritt beginnt man oben mit dem
Top-picture an der y-Anfangsposition, dann das
mittlere und schließlich das untere
Bottom-picture zu setzen. Deine
Anpassungen bzgl. der Fortschrittbalkenlänge legst Du mit den
Parametern w (horizontal) oder h (vertikal) fest (siehe progress control GUI). Die von mir erstellten pictures sind zT. halbtransparent und wie bereits erwähnt in der cpIcons.icl (Iconbibliothek) in der Reihenfolge
Links-Mitte-Rechts bzw.
Top-Vertical-Bottom abgelegt. Du kannst aber auch ersatzweiße eigene pictures als png-Dateien erstellen und diese nach diesem Schema positionieren (siehe weiteres Beispiel: bottleProgress.ahk).
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 11:50
by moefr01
hier die Anhänge:
bottleprogress.ahk, bottle64x248.png, bottleprogress.gif in der
bottleprogress.zip
- Himbeersaft!
- bottleprogress.gif (110.29 KiB) Viewed 5121 times
Code: Select all
Gui, -DPIScale +E0x02080000 ;doublebuffered GUI
Gui, Color, FFCC00 ;GUI windowcolor (see edge of left & right part)
Gui, Add, Text, x34 y130 w36 h48 vCandyTextV cFFFFFF BackgroundTrans Center
Gui, Add, Pic, x20 y20 w64 h248 BackgroundTrans, bottle64x248.png
Gui, Add, Progress, x22 y84 w60 h184 vCandyProgressV vertical ;-Smooth = deactivates colorizing!
Gui, Show, x500 y500 w104 h288, CandyProgress
value = 0
Loop {
color = FF0070 ;raspberry
GuiControl, +c%color%, CandyProgressV ;set vertical progress color
GuiControl, , CandyProgressV, % abs(value) ;set vertical progress value
GuiControl, , CandyTextV, % abs(value) "`n%" ;set vertical progress text %
value += 1
if value > 100
{
Sleep, 2000
value = -100-value
}
Sleep, 10
}
Return
GuiEscape:
GuiClose:
ExitApp
Have fun! ... moefr01
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 11:51
by BoBo
[beancount]Die Flasche unten gerade machen (wie den Ausguss oben) sonst stimmt auf die(se kurze) Länge die Perspektive des Flüssigkeitstandes nicht mehr.[/beancount]
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 12:03
by moefr01
- perspektivische Geraderückung der Flasche:-)
- bottle64x248.png (27.49 KiB) Viewed 5111 times
Du hast ja so Recht ...
BoBo ... Danke für den Ratschlag
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 12:30
by moefr01
kleine Syntax-Korrektur in Zeile 18:
Code: Select all
...
value := -value ;vorher falsch: value = -100-value
...
Re: candyprogress - Fortschritt einmal anders...
Posted: 11 Apr 2021, 13:33
by Frosti
Ja cool das sollte eigentlich nur ein Witz sein! Die Weinflasche ist aber besser als eine Bierflasche.
Re: candyprogress - Fortschritt einmal anders...
Posted: 12 Apr 2021, 07:19
by moefr01
Hallo liebe AHK-Coder,
ich habe heute den
code optimiert und die
grafischen Fehler in den Icons
entfernt.
- Vorschau
- candyprogress.gif (430.45 KiB) Viewed 5021 times
Code: Select all
;CandyProgress... candy-like progressbar with rounded edges and semitransparent overlay-graphics,
; length-setting possible, use own transparent png-graphics optionally as edge-icons
;coded 2021 by moefr01
;https://www.autohotkey.com/boards/viewtopic.php?f=10&t=89198
;========================================================================================================================
#NoEnv
#Persistent
#NoTrayIcon
#SingleInstance Force
SetBatchLines -1
SetWinDelay -1
SendMode Input
SetWorkingDir %A_ScriptDir%
;========================================================================================================================
Gui, -DPIScale +E0x02080000 ;doublebuffered GUI ...for smoothiness and no flicker! ;-)
Gui, Color, 00B2FF ;GUI windowcolor (see edge of left, middle & right progress-iconparts)
Gui, Font, s8 cFFFFFF, Segoe UI ;font, size & color
Gui, Margin, 20, 20 ;margin of controls
;========================================================================================================================
Gui, Add, Text, xm ym w436 h38 vCandyText BackgroundTrans Center ;text overlay = topmost
Gui, Add, Pic, xm ym w18 h38 BackgroundTrans Icon1, cpIconsBlau.icl ;left progresspart w18h38
Gui, Add, Pic, x+ w400 h38 BackgroundTrans Icon2, cpIconsBlau.icl ;middle progresspart w400h38
Gui, Add, Pic, x+ w18 h38 BackgroundTrans Icon3, cpIconsBlau.icl ;right progresspart w18h38
Gui, Add, Progress, xm ym w436 h38 vCandyProgress ;-Smooth ;<= deactivates colorizing
;========================================================================================================================
Gui, Add, Text, xm y120 w38 h76 vCandyTextV BackgroundTrans Center ;text overlay = topmost
Gui, Add, Pic, xm y70 w38 h18 BackgroundTrans Icon4, cpIconsBlau.icl ;top progresspart w38h18
Gui, Add, Pic, y+ w38 h100 BackgroundTrans Icon5, cpIconsBlau.icl ;vertical middle progresspart w38h100
Gui, Add, Pic, y+ w38 h18 BackgroundTrans Icon6, cpIconsBlau.icl ;bottom progresspart w38h18
Gui, Add, Progress, xm y70 w38 h136 vCandyProgressV vertical ;-Smooth ;<= deactivates colorizing
;========================================================================================================================
Gui, Show, , CandyProgress ;show GUI
;========================================================================================================================
value = 0
Loop {
if (value >= 33) and (value <= 66)
color = FF00FF ;purple
else if value >= 66
color = 0000FF ;blue
else
color = 000000 ;black
GuiControl, +c%color%, CandyProgress ;set progress color or commentize for -Smooth effect
GuiControl, , CandyProgress, % abs(value) ;set progress value
GuiControl, , CandyText, % abs(value) " %" ;set progress text with % symbol
GuiControl, +c%color%, CandyProgressV ;set vertical progress color or commentize for -Smooth effect
GuiControl, , CandyProgressV, % abs(value) ;set vertical progress value
GuiControl, , CandyTextV, % abs(value) "`n%" ;set vertical progress text with % symbol
value += 1
if value > 100
{
Sleep, 2000
value := -value
}
Sleep, 50
}
Return
;========================================================================================================================
GuiEscape:
GuiClose:
ExitApp
Viele Grüße...moefr01
Re: candyprogress - Fortschritt einmal anders...
Posted: 13 Apr 2021, 12:35
by moefr01
Ich habe heute die
candyprogress-Versionen um eine Variante erweitert... diesmal
ohne Hintergrundcolorierung aber mit
animierter Form.
Funktionsweise: 3 Icons (32x64px) in einer icl-Bibliothek erstellt, linkes Icon ist statisch, das mittlere wird in der Breite gestreckt, rechtes Icon wird mit zunehmender Breite verschoben (umgesetzt mit GUI, Move ...)
- Version 2
- candyprogress2.gif (549.33 KiB) Viewed 4971 times
Code stelle ich demnächst ein.
moefr01
Re: candyprogress - Fortschritt einmal anders...
Posted: 14 Apr 2021, 00:09
by Frosti
Wird ja immer besser.
Könntest Du auch ein Spritze animieren?
Re: candyprogress - Fortschritt einmal anders...
Posted: 14 Apr 2021, 01:40
by BoBo
@moefr01 -
Anm. Wenn die Ausgangslage eine Kugel darstellen soll, wäre dann die Lichtreflektion (bzw. dessen gerade Linien) auf deren Oberfläche nicht kugeliger/kreisförmiger/gewölbter auszuformen? Da das sicherlich zu aufwändig wäre dürfte die Reflektion in Position '0' als Kreis anzulegen die einfachste Lösung sein ...
Re: candyprogress - Fortschritt einmal anders...
Posted: 14 Apr 2021, 05:08
by garry
danke , sehr schöne Beispiele , hier noch ein Progress-Bar ...
Re: candyprogress - Fortschritt einmal anders...
Posted: 14 Apr 2021, 06:51
by BoBo