Autor Beitrag
Hack Gott
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Do 01.06.06 21:31 
Ich will eine eigene Progressbar schreiben, die an das Design von Mac OSX angelehnt sein soll. user defined image
Wie muss ich das machen? Soll ich den Komponenten TProgressBar weiterentwickeln (wie geht das?) oder soll ich einfach einzelne Bilder immer wieder zeigen lassen (insgesamt 100 dann und überhaupt ist das keine schöne Lösung...). oder gibts noch ne andere Möglichkeit?
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Do 01.06.06 23:59 
Du nimmst dir zwei Images.
Das erste ist der Hintergrund, das zweite ist die "Füllung".
Je nachdem wieviel Prozent angezeigt werden sollen vergrößerst bzw. verkleinerst du das zweite Image. (mit Width)
Hack Gott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Fr 02.06.06 01:00 
hmm bei der möglichkeit hab ich aber das problem, das wenn ich beispielsweise mit 100 % arbeiten will, es immer nur einen width gesamtwert von 100, 200, 300,... haben darf.
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: Fr 02.06.06 01:19 
ähm why?
Hack Gott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Fr 02.06.06 10:26 
warte, beispiel:

ich will eine progressbar generieren mit folgenden werten:

max: 37
min: 0
value: 0

so jetzt hab ich aber noch einen Timer, in dem ich schreib das er die progressbar alle 2 sekunden um 1 erhöhen soll:

ausblenden Delphi-Quelltext
1:
2:
image2.width := image2.width + 1
if image2.width = 37 then timer1.enabled := false;


Soso alles schöng und gut, aber jetzt ist meine progressbar nur 37 lang (bzw. ich kann die größe verdoppeln...). das ist nicht wirklich flexibel, gibt es den keine andere Möglichkeit?
[/user]
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 30



BeitragVerfasst: Fr 02.06.06 10:33 
Theoretisch ist es flexibel, denn wie man in dem Bild sieht das du gepostet hast, wiederholt sich es immer. Also nimmst du auch ein kleines Images und legst sie so nebeneinander..
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Fr 02.06.06 10:40 
was is daran nicht flexibel?
du, ich würde das eh nicht mit pixeln, sondern mit Prozenten machen.
Also es gibt die variablen max , min, step und value
dazu noch die Größe Image1.Width;
Die Variable Step setzen wir, die sollte sein:
step:=Image1.Width div (max-min);
Und wenn du die value geändert wird, kannst du ja abfragen
Image1.Width:=value*step;
und in deinem Timer schreibst du dann halt
value:=value +1

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
Hack Gott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Di 06.06.06 20:27 
Also, so wie ihr des beschrieben habt läuft des alles auch super. Jetzt habe ich aber ein echte Mac ProgressBar gesehen und musste mit erstaunen feststellen, das sich das ja irgendwie "bewegt". Ich habs mal als Video aufgenommen.
Einloggen, um Attachments anzusehen!
_________________
"Je mehr Käse, desto mehr Löcher; Je mehr Löcher, desto weniger Käse. Daraus folgt: Je mehr Käse desto weniger Käse!"
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Di 06.06.06 21:09 
Du könntest das Bild per Canvas ins Image zeichnen.
So kannst du es auch versetzen.
Kann aber sein das Canvas etwas langsam ist.
root_at_localhost
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 191



BeitragVerfasst: Di 06.06.06 21:13 
ich hab nen ganz anderen Ansatz, schon mehrfach erfolgreich gemacht...
Erstell ne neue Komponentete, abgeleitet von TGraphicControl, schau dir am besten die TGauge-Kompo an, die is bei Delphi inklusive Source schon dabei.
Alles was du zeichnen willst, d.h. das ganze Design, erledigst du in der Paint-Methode.

Wenn du noch Fragen hast melde dich einfach...