Kompliziert?
Delphi-Quellcode:
Procedure TForm1.SetExclusiveLabelAndPanelColor(aLabel : TLabel; aExclusiveColor, aDisableColor : TColor);
var
i : Integer;
c : TColor;
begin
for i:=0 to myLabel.Count-1 do begin
if myLabel[i]=aLabel then
c := aExclusiveColor
else
c := aDisableColor;
myLabel[i].Color := c;
myPanel[i].Color := c;
end
end;
Procedure TForm1.Label1Click (Sender : TObject);
begin
if Sender is TLabel then
SetExclusiveLabelAndPanelColor(TLabel(Sender), clBlue, clBlack);
end;
Allen Labeln den 'Label1Click'-Eventhandler im 'OnClick' Event zuweisen.