ฉันอยากจะเป็นเจควบคุมเป็นตำแหน่งจากชื่อ. นี่คือสิ่งที่ฉันต้องถึง:
private Point FindControlLocation(string ControlName, Control ParentControl)
{
//Code...
}
ขอบคุณสำหรับอะไรช่วยด้วย!
ฉันอยากจะเป็นเจควบคุมเป็นตำแหน่งจากชื่อ. นี่คือสิ่งที่ฉันต้องถึง:
private Point FindControlLocation(string ControlName, Control ParentControl)
{
//Code...
}
ขอบคุณสำหรับอะไรช่วยด้วย!
คุณไม่ต้องการให้พ่อแม่การควบคุมใช้รูปแบบและ recursive อกตัวเลือกจาก Controls.Find()
:
private Point FindControlLocation(string ControlName)
{
Control ctl = this.Controls.Find(ControlName, true).FirstOrDefault() as Control;
return (ctl != null) ? ctl.Location : new Point();
}