Hej! {brawo}
Tak sobie z nudów zacząłem pisać Kółko i Krzyżyk :D i mam problemik (pytanie) hmm... .
Mam procedurę którą sprawdza wygraną:
procedure TForm1.SprawdzKtoWygral;
begin
if (x1.Caption = 'X') and (x2.Caption = 'X') and
(x3.Caption = 'X') or (x1.Caption = 'O') and
(x2.Caption = 'O') and (x3.Caption = 'O') then
Wygrana;
if (x4.Caption = 'X') and (x5.Caption = 'X') and
(x6.Caption = 'X') or (x4.Caption = 'O') and
(x5.Caption = 'O') and (x6.Caption = 'O') then
Wygrana;
if (x7.Caption = 'X') and (x8.Caption = 'X') and
(x9.Caption = 'X') or (x7.Caption = 'O') and
(x8.Caption = 'O') and (x9.Caption = 'O') then
Wygrana;
if (x1.Caption = 'X') and (x4.Caption = 'X') and
(x7.Caption = 'X') or (x1.Caption = 'O') and
(x4.Caption = 'O') and (x7.Caption = 'O') then
Wygrana;
if (x2.Caption = 'X') and (x5.Caption = 'X') and
(x8.Caption = 'X') or (x2.Caption = 'O') and
(x5.Caption = 'O') and (x8.Caption = 'O') then
Wygrana;
if (x3.Caption = 'X') and (x6.Caption = 'X') and
(x9.Caption = 'X') or (x3.Caption = 'O') and
(x6.Caption = 'O') and (x9.Caption = 'O') then
Wygrana;
if (x1.Caption = 'X') and (x5.Caption = 'X') and
(x9.Caption = 'X') or (x1.Caption = 'O') and
(x5.Caption = 'O') and (x9.Caption = 'O') then
Wygrana;
if (x3.Caption = 'X') and (x5.Caption = 'X') and
(x7.Caption = 'X') or (x3.Caption = 'O') and
(x5.Caption = 'O') and (x7.Caption = 'O') then
Wygrana;
end;
Przyciski są nazwane kolejno:
x1 x2 x3
x4 x5 x6
x7 x8 x9
I co trzeba dopisać do wygranej aby odpowiednia wygrana linia się pokolorowała na czerowno. Próbowałem swoich metod ale mi nie wychodziło.
Jak możecie to pomóżcie proszę {browar}
Pozdrawiam :-)