delphi 动态创建 复选框控件

procedure TFrmSysIni.FormCreate(Sender: TObject);
var
  I:Integer;
  Col,Row:Integer;//第几列
begin
  TabelList:=TStringList.Create;
  DM1.ADOC1.GetTableNames(TabelList);
  Col:=0; Row:=0;
  For I:=0 to TabelList.Count-1 do
  begin
    if Col>13 then
    begin
      Col:=0;
      Row:=Row +1 ;
    end;
    CheckList:=TRzCheckBox.Create(Self);
    with CheckList do
    begin
      Parent:=RzPanel1;
      Width:=140;
      Height:=20;
      Left:=16 +(Row*140);
      Top:=16 + (Col*24);
      Name:= 'CheckList'+inttostr(I);
      Caption:= TabelList.Strings[I];
      Visible:=true;
      if TabelList.Strings[I]='COM_DB' then Enabled:=False;
      if TabelList.Strings[I]='COM_PARA' then Enabled:=False;
      if TabelList.Strings[I]='TIME_SORT' then Enabled:=False;
      if TabelList.Strings[I]='TIME_RULE' then Enabled:=False;
      if TabelList.Strings[I]='COM_CODE' then
      begin
        //Enabled:=False;
        Color:=clRed;
       // OnClick:=CheckListOnClick;
      end;
      if TabelList.Strings[I]='CHARGE_STATION' then Enabled:=False;

      Transparent:=True;
    end;
    Col:=Col +1;
  end;
end;

原文地址:https://www.cnblogs.com/yoogoo/p/2527930.html