하는 방법을 찾기 제어 기반의 위치에서 제어의 이름을

0

질문

하고 싶은 기본적으로 찾기 제어하의 위치를 기반으로 이름입니다. 이것은 내가 지금까지:

private Point FindControlLocation(string ControlName, Control ParentControl)
{
    //Code...
}

어떤 도움을 주셔서 감사합니다!

c# controls winforms
2021-11-12 23:53:57
1

최고의 응답

1

당신이 실제로 필요하지 않은 상위 제어,그냥 양식을 사용하고 재귀에서 옵션을 Controls.Find():

private Point FindControlLocation(string ControlName)
{
    Control ctl = this.Controls.Find(ControlName, true).FirstOrDefault() as Control;
    return (ctl != null) ? ctl.Location : new Point();
}
2021-11-13 01:54:51

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................