Find controls on the form (C #)

zhaozj2021-02-16  96

I saw someone asked someone to find a control on the specified form, and many answers were used to use the Foreach loop, which is actually in exact. When you want to find the control placed on a groupbox or

On Panel, it is not enough to use foreach.

Private void getFlexGrid (Control Ctrl)

{

FOREACH (Control C)

In Ctrl.Controls)

{

IF (c

Is FlexGrid?

{

// Operation for the control found;

}

IF (c.Controls.count! = 0)

{

GetFlexGrid (c);

}

}

}

转载请注明原文地址:https://www.9cbs.com/read-14202.html

New Post(0)