在MDI子窗体里怎么遍历MDI窗体里的所有控件?
或都在MDI子窗体里怎么访问主窗体里的statusStrip控件?
(我把MDI主窗体的控件的statusStrip控件的Modifiers属性设为Public了还是不行)

解决方案 »

  1.   

    foreach(Control in sheetForm.Controls)
    {
       if (Control is System.Windows.Forms.StatusStrip)
       {
          .....
       }
    }
      

  2.   

    foreach(Control ctrl in sheetForm.Controls)
    {
       if (ctrl is System.Windows.Forms.StatusStrip)
       {
          .....
       }
    }
      

  3.   

    (childform.MDIParent as XXXForm).statusStrip1...
      

  4.   

    我是这样的:
                foreach (Control tl in FrmMain.ActiveForm.Controls)
                {
                     if (tl.Name == "statusStripMain")
                    {
                        foreach (Control ts1 in tl.Controls)
                        {                        if (ts1.Name == "toolStripStatusLabel1")
                                ts1.Text = "aaa";   //操作员名称
                        }
                    }            }
    但是怎么也找不到statusStripMain里的toolStripStatusLabel1
      

  5.   

    问题解决了,只能在MDI窗体里加个label,然后在change事件里处理!