Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi If Problem (https://www.delphipraxis.net/103429-if-problem.html)

Sharky 15. Nov 2007 17:42

Re: If Problem
 
Hai Poring,

nur mal so aus Spass eine andere Lösung ;-)
Delphi-Quellcode:
var
  CheckBoxState: Byte;

procedure PannelFarbe(aPanel: TPanel; aCode: Byte);
var
  farbe: TColor;
begin
  case aCode of
    0: farbe := clBtnFace;
    1: farbe := clred;
    2: farbe := clgreen;
    3: farbe := clblue;
    4: farbe := clMaroon;
    5: farbe := clDkGray;
    6: farbe := clLime;
    7: farbe := clPurple;
  end;
  aPanel.Color := farbe;
end;

procedure TDemo_Form.AlleCBOnClick(Sender: TObject);
begin
  if (Sender as TCheckBox).Checked then
    CheckBoxState := CheckBoxState + (Sender as TCheckBox).Tag
  else
    CheckBoxState := CheckBoxState - (Sender as TCheckBox).Tag;
  PannelFarbe(Panel1, CheckBoxState);
end;

procedure TDemo_Form.FormCreate(Sender: TObject);
begin
  CheckBoxState := 0;
  CheckBox1.Tag := 1; // Kann man natürlich auch im OI setzen.
  CheckBox2.Tag := 2;
  CheckBox3.Tag := 4;
  PannelFarbe(Panel1, CheckBoxState);
end;

Poring 15. Nov 2007 18:14

Re: If Problem
 
Ok danke euch! Wünschte so viel antworten würd ich bei jeder Frage bekommen *g*


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:07 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz