asp_boy(asp_boy):最近比较忙!你试试下面的代码就知道有效果。 我依次放上了button1,2,3,4,5 执行button5后,返回顺序:button2,1,3,4,5. 你自己查帮助,setchildeorder只有在getchildren才有效。 Changes the order in which Child appears when GetChildren is called.procedure TForm1.Button5Click(Sender: TObject); begin Form1.SetChildOrder(Button2,0); Form1.GetChildren(Handle,Form1); end;procedure TForm1.Handle(Child: TComponent); begin ShowMessage((Child As TButton).Caption); end;end.
我依次放上了button1,2,3,4,5
执行button5后,返回顺序:button2,1,3,4,5.
你自己查帮助,setchildeorder只有在getchildren才有效。
Changes the order in which Child appears when GetChildren is called.procedure TForm1.Button5Click(Sender: TObject);
begin
Form1.SetChildOrder(Button2,0);
Form1.GetChildren(Handle,Form1);
end;procedure TForm1.Handle(Child: TComponent);
begin
ShowMessage((Child As TButton).Caption);
end;end.