...
procedure TForm1.CheckListBox1ClickCheck(Sender: TObject);
var
i, c: Integer;
begin
c:= 0;
with TCheckListBox(Sender) do
begin
for i:= Items.Count -1 downto 0 do
if State[i] = cbChecked then Inc(c);
if c > 2 then
begin
Checked[ItemIndex]:= False;
raise Exception.Create('Sólo pueden seleccionarse dos colores');
end;
end;
end;
procedure TForm1.btnSendToLabelsClick(Sender: TObject);
var
i,c: Integer;
s: array[0..1] of string;
begin
with CheckListBox1 do
begin
c:= 0;
for i:= 0 to Items.Count-1 do
if Checked[i] then
begin
s[c]:= QuotedStr(Items[i]);
Inc(c);
end;
end;
Label7.Caption:= s[0];
Label8.Caption:= s[1];
end;