1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| unit Unit22;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, CheckLst, StdCtrls, ExtCtrls;
type
TFormMain = class(TForm)
ButtonCheckList: TButton;
RadioGroupGenre: TRadioGroup;
procedure ButtonCheckListClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
public
CheckList : TCheckListBox;
procedure DoCheckListClick(Sender: TObject);
procedure DoCheckListDblClick(Sender: TObject);
end;
var
FormMain: TFormMain;
implementation
{$R *.dfm}
procedure TFormMain.DoCheckListClick(Sender: TObject);
begin
//
end;
procedure TFormMain.DoCheckListDblClick(Sender: TObject);
begin
//
end;
procedure TFormMain.ButtonCheckListClick(Sender: TObject);
var N : integer;
begin
if not assigned(fCheckList) then
begin
CheckList := TCheckListBox.Create(Self);
CheckList.SetBounds(RadioGroupGenre.left+RadioGroupGenre.Width+4,
RadioGroupGenre.Top,
RadioGroupGenre.Width,
RadioGroupGenre.Height);
CheckList.Color := clSkyBlue;
CheckList.Style := lbOwnerDrawFixed;
CheckList.ItemHeight := 20;
CheckList.OnClick := DoCheckListClick;
CheckList.OnDblClick := DoCheckListDblClick;
CheckList.Parent := Self;
CheckList.Items.Assign(RadioGroupGenre.Items);
for N := 0 to CheckList.Count - 1 do
CheckList.Checked[N] := true;
end;
(Sender as TButton).Enabled := not assigned(CheckList);
end;
procedure TFormMain.FormDestroy(Sender: TObject);
begin
if Assigned(fCheckList) then
CheckList.Free;
end;
end. |
Partager