动态创建控件,调用GetChildAtPoint()方法获取指定坐标上的控件,参数为控件的location,但返回为空!
代码如下:foreach (Control ctrl in this.Controls)
{
if(this.GetChildAtPoint(ctrl.Location))
{
MessageBox.Show(ctrl.Name);
}
}
返回的结果为NULLnullGetChildAtPoint()
代码如下:foreach (Control ctrl in this.Controls)
{
if(this.GetChildAtPoint(ctrl.Location))
{
MessageBox.Show(ctrl.Name);
}
}
返回的结果为NULLnullGetChildAtPoint()
foreach (Control ctrl in this.Controls)
{
MessageBox.Show(ctrl.Name);
}
遍历能获取到控件,控件的父容器的xtraScrollableControl,这个容器是拖到窗体上的。