把.cs文件解析成XMl,在线等
  private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.txtPassword = new System.Windows.Forms.TextBox();
            this.btnSave = new zjs.GradientButton();
            this.btnReturn = new zjs.GradientButton();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular);
            this.label1.Location = new System.Drawing.Point(3, 11);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(116, 16);
            this.label1.Text = "请输入管理员密码:";<control name="AreaQueryView" id="btnQuery" X="199" Y="6" width="37" height="64" text="查询[S1]" HotKey="" /> 
保存成这样的

解决方案 »

  1.   

    就是把控件的大小位置名称等保存成功xml格式
      

  2.   


    XmlDocument xmldoc = new XmlDocument ( ) ;XmlDeclaration xmldecl;
    xmldecl = xmldoc.CreateXmlDeclaration("1.0","gb2312",null);
    xmldoc.AppendChild ( xmldecl);//加入一个根元素
    XmlElement xmlelem = xmldoc.CreateElement( "" , "controls" , "" ) ;
    xmldoc.AppendChild ( xmlelem ) ;
    XmlElement control=xmldoc.CreateElement("name","名称")
     
    control.SetAttribute("name","name值");//添加属性control.SetAttribute("id","id值");//
    xmlelem.appendchild(control);
    xmldoc.save(server.mappath("control.xml"));
      

  3.   

    XmlElement control=xmldoc.CreateElement("control","名称")
      

  4.   

    动态生成的控件 转换成XML?利用反射获取控件对象实例相应的属性,生成XML
      

  5.   

    我是把所有的winform窗体,中的窗体名称,控件的大小,名称,位置 保存成xml格式的信息