Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
Delphi 2006 Professional
|
Re: Checkbox
5. Apr 2007, 18:44
Jo. is wohl sinnvoller:
Delphi-Quellcode:
function MakeCheckBoxes(Container: TWinControl; Captions: TStrings; CBOnClick: TNotifyEvent = nil): TObjectList;
var i: Integer;
Size: TSize;
buf: string;
begin
Result := TObjectList.Create;
for i := 0 to Captions.Count-1 do
with Result[Result.Add(TCheckBox.Create(Container))] as TCheckBox do //sorry dafür. aber da mach ich jetzt kein extra faß variablen für auf.
begin
Parent := Container;
Top := i * 16; //reicht 16?
Left := 3;
Height := 16;
buf := Captions[i];
GetTextExtentPoint32(Canvas.Handle, @buf[1], Length(buf),Size);
Width := Size.cx + 16; //16 extra für die Box
Tag := i;
Caption := buf;
OnClick := CBOnClick;
end;
end;
Lukas Erlacher
|
|
Zitat
|