小提示,二楼的代码在改下,伪代码,楼主继续完善procedure SetTop(Sender:Tobject);var......beginfor i:=0 to Sender.controlcont-1 do begin if 判段是不是Tspeedbutton then speedbutton.top:=1 if 判段是不是容器(panel,groupbox等) then SetTop( Sender.);end;end;
var i:integer; sb:Tspeedbutton;beginfor i:=0 to form1.ComponentCount -1 do begin if form1.Components is Tspeedbutton then begin sb:=form1.Components as Tspeedbutton; sb.top := 1; end; end;