我想基本上找到一个控制的位置的基础上的名字。 这是我迄今为止:
private Point FindControlLocation(string ControlName, Control ParentControl)
{
//Code...
}
感谢任何的帮助!
我想基本上找到一个控制的位置的基础上的名字。 这是我迄今为止:
private Point FindControlLocation(string ControlName, Control ParentControl)
{
//Code...
}
感谢任何的帮助!
你其实不需要父母控制,只是使用的形式和递归的选项 Controls.Find()
:
private Point FindControlLocation(string ControlName)
{
Control ctl = this.Controls.Find(ControlName, true).FirstOrDefault() as Control;
return (ctl != null) ? ctl.Location : new Point();
}