try something like
void GetControls (Control c)
{
  System.Console.WriteLine(c.GetType().Name);
  foreach (Control child in c.Controls)
  {
         GetControls(child);
  }
}in your form, call
GetControls(this);

解决方案 »

  1.   

    thank you very much
    i have solved my question with your method.
    but i think if add some code to judge if child is container   before GetControls(child), the efficiency maybe better,but i don't know how to,do you ? thank you!
    i'm sorry,my english is not so good! :)
      

  2.   

    should not matter, because if the control is not a container, the code inside foreach{} is never executed, but if you insist, you could dovoid GetControls (Control c)
    {
      System.Console.WriteLine(c.GetType().Name);
      if (c.Controls.Count > 0)
        foreach (Control child in c.Controls)
        {
             GetControls(child);
        }
    }
      

  3.   

    i see!
    i admire  that not only your technology but also your English are so good,i want to make friends with you very much,OK?My email is :
    [email protected], eager to receive your letter! :) 
    thank you again!