Ich hab mal schnell was gebastelt:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| procedure DrawProgressBar(x,y,width,progress,color: byte); var Coord: TCoord; st: string; style: word; i: integer; begin style := GetTextStyle; Coord.x := x; Coord.y := y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Coord); SetConsoleTextAttribute(getstdhandle(STD_OUTPUT_HANDLE), color*16); st := ''; for i := 1 to progress do st := st + ' '; write(st); SetConsoleTextAttribute(getstdhandle(STD_OUTPUT_HANDLE), style); st := ''; for i := 1 to width-progress do st := st + ' '; write(st); end; |
x und y sind die Koordinaten
width ist die Gesamtbreite
progress ist die Breite des Balkens
color ist die Farbe des Balkens (0-15)
der Freie Bereich hat die Standardfarbe (i.d.R. Schwarz)
//Edit:
uses Windows nicht vergessen...