um das pandemische Leben einmal etwas bunter 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!
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
moefr01