倒,cs中只定义这些东西,具体的实例化过程,是在.aspx中。

解决方案 »

  1.   

    你说的界面设计代码,实际上是aspx页生成的过程,这个过程中,实例化个元件,如,一个label,在aspx生成的时候才定义它的各种属性,如text,font等等。
    cs只负责定义这个类。
      

  2.   

    private void InitializeComponent()
    {
    this.button1 = new System.Windows.Forms.Button();
    this.comboBox1 = new System.Windows.Forms.ComboBox();
    this.publicationdate = new System.Windows.Forms.TextBox();
    this.ISBN = new System.Windows.Forms.TextBox();
    this.innerText = new System.Windows.Forms.TextBox();
    this.label1 = new System.Windows.Forms.Label();
    this.label2 = new System.Windows.Forms.Label();
    this.label3 = new System.Windows.Forms.Label();
    this.firstname = new System.Windows.Forms.TextBox();
    this.lastname = new System.Windows.Forms.TextBox();
    this.label4 = new System.Windows.Forms.Label();
    this.label5 = new System.Windows.Forms.Label();
    this.label6 = new System.Windows.Forms.Label();
    this.price = new System.Windows.Forms.TextBox();
    this.zt = new System.Windows.Forms.Label();
    this.button2 = new System.Windows.Forms.Button();
    this.label7 = new System.Windows.Forms.Label();
    this.label8 = new System.Windows.Forms.Label();
    this.button3 = new System.Windows.Forms.Button();
    this.button4 = new System.Windows.Forms.Button();
    this.treeView1 = new System.Windows.Forms.TreeView();
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(432, 112);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(112, 40);
    this.button1.TabIndex = 0;
    this.button1.Text = "添加内容并保存";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // comboBox1
    // 
    this.comboBox1.Items.AddRange(new object[] {
       "11111",
       "22222",
       "33333",
       "44444",
       "55555",
       "66666"});
    this.comboBox1.Location = new System.Drawing.Point(312, 248);
    this.comboBox1.Name = "comboBox1";
    this.comboBox1.Size = new System.Drawing.Size(100, 20);
    this.comboBox1.TabIndex = 1;
    // 
    // publicationdate
    // 
    this.publicationdate.Location = new System.Drawing.Point(312, 128);
    this.publicationdate.Name = "publicationdate";
    this.publicationdate.TabIndex = 2;
    this.publicationdate.Text = "";
    // 
    // ISBN
    // 
    this.ISBN.Location = new System.Drawing.Point(312, 168);
    this.ISBN.Name = "ISBN";
    this.ISBN.TabIndex = 3;
    this.ISBN.Text = "";
    // 
    // innerText
    // 
    this.innerText.Location = new System.Drawing.Point(312, 8);
    this.innerText.Name = "innerText";
    this.innerText.TabIndex = 4;
    this.innerText.Text = "";
    // 
    // label1
    // 
    this.label1.Location = new System.Drawing.Point(208, 16);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(64, 23);
    this.label1.TabIndex = 5;
    this.label1.Text = "innerText";
    // 
    // label2
    // 
    this.label2.Location = new System.Drawing.Point(208, 136);
    this.label2.Name = "label2";
    this.label2.Size = new System.Drawing.Size(104, 32);
    this.label2.TabIndex = 6;
    this.label2.Text = "publicationdate";
    // 
    // label3
    // 
    this.label3.Location = new System.Drawing.Point(208, 176);
    this.label3.Name = "label3";
    this.label3.Size = new System.Drawing.Size(48, 23);
    this.label3.TabIndex = 7;
    this.label3.Text = "ISBN";
    // 
    // firstname
    // 
    this.firstname.Location = new System.Drawing.Point(312, 48);
    this.firstname.Name = "firstname";
    this.firstname.TabIndex = 8;
    this.firstname.Text = "";
    // 
    // lastname
    // 
    this.lastname.Location = new System.Drawing.Point(312, 88);
    this.lastname.Name = "lastname";
    this.lastname.TabIndex = 9;
    this.lastname.Text = "";
    // 
    // label4
    // 
    this.label4.Location = new System.Drawing.Point(208, 96);
    this.label4.Name = "label4";
    this.label4.Size = new System.Drawing.Size(64, 23);
    this.label4.TabIndex = 10;
    this.label4.Text = "lastname";
    // 
    // label5
    // 
    this.label5.Location = new System.Drawing.Point(208, 56);
    this.label5.Name = "label5";
    this.label5.Size = new System.Drawing.Size(64, 23);
    this.label5.TabIndex = 11;
    this.label5.Text = "firstname";
    // 
    // label6
    // 
    this.label6.Location = new System.Drawing.Point(208, 216);
    this.label6.Name = "label6";
    this.label6.Size = new System.Drawing.Size(64, 23);
    this.label6.TabIndex = 13;
    this.label6.Text = "price";
    // 
    // price
    // 
    this.price.Location = new System.Drawing.Point(312, 208);
    this.price.Name = "price";
    this.price.TabIndex = 12;
    this.price.Text = "";
    // 
    // zt
    // 
    this.zt.Location = new System.Drawing.Point(240, 312);
    this.zt.Name = "zt";
    this.zt.Size = new System.Drawing.Size(312, 48);
    this.zt.TabIndex = 14;
    // 
    // button2
    // 
    this.button2.Location = new System.Drawing.Point(432, 32);
    this.button2.Name = "button2";
    this.button2.Size = new System.Drawing.Size(112, 40);
    this.button2.TabIndex = 15;
    this.button2.Text = "打开一个需要增加内容的XML文件";
    this.button2.Click += new System.EventHandler(this.button2_Click);
    // 
    // label7
    // 
    this.label7.Location = new System.Drawing.Point(208, 256);
    this.label7.Name = "label7";
    this.label7.Size = new System.Drawing.Size(40, 23);
    this.label7.TabIndex = 16;
    this.label7.Text = "genre";
    // 
    // label8
    // 
    this.label8.Location = new System.Drawing.Point(208, 288);
    this.label8.Name = "label8";
    this.label8.Size = new System.Drawing.Size(56, 23);
    this.label8.TabIndex = 17;
    this.label8.Text = "状态:";
    // 
    // button3
    // 
    this.button3.Location = new System.Drawing.Point(432, 256);
    this.button3.Name = "button3";
    this.button3.Size = new System.Drawing.Size(112, 40);
    this.button3.TabIndex = 18;
    this.button3.Text = "退出";
    this.button3.Click += new System.EventHandler(this.button3_Click);
    // 
    // button4
    // 
    this.button4.Location = new System.Drawing.Point(432, 184);
    this.button4.Name = "button4";
    this.button4.Size = new System.Drawing.Size(112, 40);
    this.button4.TabIndex = 19;
    this.button4.Text = "显示文件树形结构";
    this.button4.Click += new System.EventHandler(this.button4_Click);
    // 
    // treeView1
    // 
    this.treeView1.ImageIndex = -1;
    this.treeView1.Location = new System.Drawing.Point(8, 8);
    this.treeView1.Name = "treeView1";
    this.treeView1.SelectedImageIndex = -1;
    this.treeView1.Size = new System.Drawing.Size(184, 352);
    this.treeView1.TabIndex = 20;
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(560, 365);
    this.Controls.Add(this.treeView1);
    this.Controls.Add(this.button4);
    this.Controls.Add(this.button3);
    this.Controls.Add(this.label8);
    this.Controls.Add(this.label7);
    this.Controls.Add(this.button2);
    this.Controls.Add(this.zt);
    this.Controls.Add(this.label6);
    this.Controls.Add(this.price);
    this.Controls.Add(this.label5);
    this.Controls.Add(this.label4);
    this.Controls.Add(this.lastname);
    this.Controls.Add(this.firstname);
    this.Controls.Add(this.label3);
    this.Controls.Add(this.label2);
    this.Controls.Add(this.label1);
    this.Controls.Add(this.innerText);
    this.Controls.Add(this.ISBN);
    this.Controls.Add(this.publicationdate);
    this.Controls.Add(this.comboBox1);
    this.Controls.Add(this.button1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false); }什么都在里面啊
      

  3.   

    拜托,我不知道你要的界面设计是什么,但是在我看来,所有需要的信息都写在里面了,比如加入control的位置,delegate,他的各种属性。你仔细看了吗?
      

  4.   


    turnmissile(会翻跟头的导弹)是HNU吗?如果是:OK,你说的,确实,各个control的信息都在了,可是,这个,是他要的东西么?原问题:“我是在.net环境下用可视的方法设计的介面,但为什么在源代码.CS文件中的InitializeComponent()中没有介面的设计代码.”他要的是什么?记录IDE下添加的控件的信息的存放位置————.aspx文件就是嘛!你说的是什么呢?是在code behind里动态添加控件的方法,效果是一样的,level比他的做法高,可是,虽然level高,却并不是他想要的东西呀。他现在需要的,不是fancy的动态生成控件的方法,他需要的,只是.aspx文件中的控件信息记录以加强对“在.net环境下用可视的方法设计介面”的理解啊。
      

  5.   

    我猜搂住问的是WEB开发中Page的InitializeComponent()方法没有控件初始化的信息,因为Windows的Form里面的InitializeComponent()方法包含了画面上所有可视化控件的初始化信息。呵呵
    因为WEB画面的可视化控件的信息都在aspx文件里面。