कैसे को खोजने के लिए एक नियंत्रण के स्थान के आधार पर नियंत्रण के नाम

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ý
..................................................................................................................

इस श्रेणी में लोकप्रिय

लोकप्रिय सवाल इस श्रेणी में