Autor Beitrag
DiamondDog
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Mo 23.03.09 14:29 
Hallo Leute,
ich hab das das Problem das meine Farbe, leider immer erst nach dem 2ten aufrufen von ColorDialog übernommen wird und ich weiß nciht ganz wie ich das beheben kann. Möchte es gerne so haben das wenn ich eine Frabe gewählt habe und auf OK klicke das dann die Farbe sofort übernommen wird, beim schließen vom ColorDialog.
So sieht mein Quelltext dafür aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.ColorDialog1Close(Sender: TObject);
begin
  Label1.Color:= ColorDialog1.Color;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ColorDialog1.Execute;
end;
Danke schon mal für eure Hilfe.

Mfg Dog
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 23.03.09 14:32 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if ColorDialog1.Execute then
  Label1.Color:= ColorDialog1.Color;
end;
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Mo 23.03.09 14:34 
Mach es doch so:

ausblenden Delphi-Quelltext
1:
2:
  if ColorDialog1.Execute then
    Label1.Color := ColorDialog1.Color;


Dann brauchst Du den Umweg über das Close-Ereignis nicht zu gehen.

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Mo 23.03.09 14:35 
Cool funktioniert besten Dank.