Hello!
Mam małe pytanie: otóż mam na formie 3 edity i buttona. Gdy klikne butona to odpala sie okienko z kolorami do wyboru (colordialog), i teraz chce zrobic tak, zeby gdy zamknie sie okiekno to zeby delphi przypisal do tych 3 editow kolory RGB z koloru ktory wybralem w okienku (r - edit1, g - edit2, b - edit3). Jak to zrobic?
z góry thx!
oto kodzik
procedure TForm1.Button1Click(Sender: TObject);
[b] var[/b]
R, G, B: [b]Integer[/b];
[b]begin[/b]
if colordialog1.Execute then
[b]begin[/b]
G:=GetGValue(Colordialog1.Color);
B:=GetBValue(Colordialog1.Color);
R:=GetRValue(Colordialog1.Color);
edit1.Text:= inttostr(r);
edit2.Text:= inttostr(g);
edit3.Text:= inttostr(b);
[b]end;
end;[/b]
Sprawdzałem, działa :)[browar]
GetRValue
GetGValue
GetBValue
[dopisane]
Qrde, jak kliknąłem przycisk "odpowiedz", to postu wyżej jeszcze nie było
[dopisane jeszcze raz]
Na szczęście mogę poprawić ten kod:
procedure TForm1.Button1Click(Sender: TObject);
begin
if ColorDialog1.Execute then
begin
Edit1.Text:= IntToStr(GetRValue(ColorDialog1.Color));
Edit2.Text:= IntToStr(GetGValue(ColorDialog1.Color));
Edit3.Text:= IntToStr(GetBValue(ColorDialog1.Color));
end;
end;
Było napisane ohydnie i marnowało pamięć.