Autor Beitrag
Fädas
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 73

Win XP
Delphi 5
BeitragVerfasst: Di 20.12.05 15:48 
Hallo, ich hab ein Problem:
Ich möchte mit Hilfe eines Timers die Farbe eines Labels verändern, was mit byte-Zahlen ja soweit funktioniert
z.B:
label1.font.color:=rgb(200,1,1);


sobald ich aber eine Variable in die Funktion schreibe, bleibt das label schwarz:

label1.font.color:=rgb(a,b,c);




Wisst ihr was darüber?
chrisw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 439
Erhaltene Danke: 3

W2K
D7
BeitragVerfasst: Di 20.12.05 15:57 
Also bei mir geht das !
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button1Click(Sender: TObject);
var a,b,c : Byte;
begin
  a := 200;
  b := 1;
  c := 1;
  Label1.Font.Color := rgb(a,b,c);
end;


Daher denke ich Dein Problem liegt im Refresh !

Versuch mal Label1.Refresh;

_________________
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.
Muetze1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 346



BeitragVerfasst: Di 20.12.05 16:04 
Die liegt bestimmt nicht im Refresh - da OnChange des Fonts ausgelöst wird und das Label drauf reagiert. Ich vermute eher, er hat die Variablen lokal im Timer deklariert...

@Fädas: Zeig mal den Code vom Timer.OnTimer

_________________
49 63 68 68 61 62 65 6B 65 69 6E 65 41 68 6E 75 6E 67 21
Fädas Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 73

Win XP
Delphi 5
BeitragVerfasst: Di 20.12.05 19:11 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
implementation
var
  a:byte=1;
  b:byte=1;
  c:byte=1;
  i:integer;
{$R *.DFM}



procedure TForm1.Timer1Timer(Sender: TObject);
begin
inc(i);
inc(a);
inc(b);
inc(c);
if i mod 2 = 0 then
label1.visible:=false
else
 label1.visible:=true;


 label1.font.color:=rgb(a,b,c);
end;


Ich wollte, dass die Farben gleichmäßig verschwimmen.
Vielleicht liegt es daran, dass ich die Variablen verändere?

Moderiert von user profile iconChristian S.: Quote- durch Delphi-Tags ersetzt
Fädas Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 73

Win XP
Delphi 5
BeitragVerfasst: Di 20.12.05 21:39 
OOOOOOOOOOH es funktioniert doch,man muss nur ein bisschen länger warten. :lol:
man kann doch Variablen benutze, aber trotzdem Danke für die Aufmerksamkeit.