Ganz schnell und billig... Nutze z.B. die Tag-Eigenschaft (ist für sowas vorgesehen)...
Delphi-Quellcode:
function MovedTaggedComponents(ParentComponent:TComponent;TagID:Integer;dx,dy:Integer):Integer;
var
i : Integer;
Comp : TComponent;
moved : Integer;
begin
moved := 0;
if assigned(ParentComponent)
then begin
for i := 0 to ParentComponent.ComponentCount-1
do begin
Comp := ParentComponent.Components[i];
if (Comp is TButton) or (Comp is TCheckbox)
then begin
if (Comp.Tag = TagID)
then with (Comp as TWinControl)
do begin
Left := Left+dx;
Top := Top+dy;
Update;
inc(moved);
end;
end;
end;
end;
result := moved;
end;
Dann hast du nur noch eien Zeile
Delphi-Quellcode:
.
MovedTaggedComponents(Form1,1,-10,50);
.