我指的不是Controls里面递归循环可以找到的那些.
我需要的是,例如鼠标右键菜单这类控件,在页面上是直接放在最下面的那种控件
由于我发现在自动生成的Form1.Designer.cs里面没有这句话.
  this.components = new System.ComponentModel.Container();
所以想要遍历也找不到,请各位指教

解决方案 »

  1.   

    采用的是DevExpress 控件
    发现没有实例化
    private System.ComponentModel.IContainer components = null;
    就是没有这段
    this.components = new System.ComponentModel.Container();
      

  2.   

    Dev控件在注册之后如果想实例化的话,是需要引用命名空间的吧
      

  3.   

    放进this.Components中的并非控件  属于组件  
    控件直接加入到父控件中的Controls集合  在this.Components中找不到
      

  4.   

    我同意的你得说法,但是目前我页面生成的组件没有加入到this.Components,所以这点我很不明白在没有this.Components的情况下我想知道他是依附谁的,我就是不知道如何获取
      

  5.   

                IContainerControl col = this.GetContainerControl();
                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 里面的嵌套的是自己写算法!
      

  6.   

    感谢你的回答,但是这个方式我还是获取不到窗体组件的信息,我指的是页面下面的例如Timer这类组件的对象