我指的不是Controls里面递归循环可以找到的那些.
我需要的是,例如鼠标右键菜单这类控件,在页面上是直接放在最下面的那种控件
由于我发现在自动生成的Form1.Designer.cs里面没有这句话.
this.components = new System.ComponentModel.Container();
所以想要遍历也找不到,请各位指教
我需要的是,例如鼠标右键菜单这类控件,在页面上是直接放在最下面的那种控件
由于我发现在自动生成的Form1.Designer.cs里面没有这句话.
this.components = new System.ComponentModel.Container();
所以想要遍历也找不到,请各位指教
发现没有实例化
private System.ComponentModel.IContainer components = null;
就是没有这段
this.components = new System.ComponentModel.Container();
控件直接加入到父控件中的Controls集合 在this.Components中找不到
Control con = this.GetNextControl(new Button(), true);
System.Collections.IEnumerator control = this.Controls.GetEnumerator();
while (control.MoveNext())
{
Control ctr = control.Current as Control;
if (ctr != null)
MessageBox.Show(ctr.Text.ToString());
}这面的全部控件获取!Groubox 或 tap 里面的嵌套的是自己写算法!