TMychecklistBox = class(tchecklistBox) public constructor Create(AOwner: TComponent);override; end;
{ TMychecklistBox } constructor TMychecklistBox.Create(AOwner: TComponent); var i: integer; begin inherited; Items.Append('chaine 1'); Items.Append('chaine 2'); Items.Append('chaine 3'); Items.Append('chaine 4'); Items.Append('chaine 5'); //cocher les éléments par défaut for i := 0 to 4 do Checked[i] := True; end;
TMychecklistBox = class(tchecklistBox) public constructor CreateAndInit(AOwner: TComponent; InitStrs: TStringList); end;
constructor TMychecklistBox.CreateAndInit(AOwner: TComponent; InitStrs: TStringList); var i: integer; begin inherited create(AOwner); Items.AddStrings(InitStrs); //cocher les éléments par défaut for i := 0 to Items.Count - 1 do Checked[i] := True; end;
Parent := AOwner as TWinControl;