如题

解决方案 »

  1.   

    遍历controls或者this.Controls.Find
      

  2.   


      int count = 0;
                foreach(Control cl in this.panel1.Controls)
                {
                    if (cl is Button)
                    {
                        count++;
                    }
                }
      

  3.   

    遍历一下controls,如果类行为button,i+1。
      

  4.   

    int c = 0;
    foreach(Control   c   in   this.Controls) 

              if(c.GetType()==Type.GetType( "Button ")) 
              { 
                      c++;
              } 
    }
    return c
      

  5.   

    foreach(Control cl in this.panel1.Controls)
                {
                    if (cl is Button)
                    {
                        count++;
                    }
                }