打印出控件的所有子控件


        private StringBuilder GetAllControlnIheForm(Control control, StringBuilder sb)
        {

 

            foreach (Control c in control.Controls)
            {

                sb.Append(c.GetType());
               
                sb.Append("\t");
                sb.Append(c.Name);
                sb.Append("\t\n");

               
                //MessageBox.Show(c.Name + ":" + c.GetType());
                if (c.GetType().ToString().CompareTo("splitContainer1") == 0)
                {
                  
                }
                if (c.HasChildren == true)
                {
                    sb.Append(GetAllControlnIheForm(c, sb));
                }
            }
            return sb;
        }

posted on 2007-10-23 14:36  步走高飞  阅读(158)  评论(0编辑  收藏  举报

导航