新建立一个window应用程序项目,上面有
Form1.cs 和 Form1.Designer.cs
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace _7_04
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
}
---------------------------
Form1.Designer.cs:
namespace _7_04
{
    partial class Form1
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }        #region Windows 窗体设计器生成的代码        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Text = "Form1";
        }        #endregion
    }
}---------------------------
这两个文件有部份的代码是一至的,他们的关系是什么呢?

解决方案 »

  1.   

    看名字就知道 Form1.Designer.cs 是 Form1.cs 的设计器代码文件...它是IDE自动生成的...你在IDE中拖放控件、设置控件属性时所需要的代码都在这里面...这是.NET 2.0以后才有的...以前的版本不支持 partial class...所以之前都放在一个文件里...
      

  2.   

    你用的如果是 vs2003 就有这个设计器代码文件
    如果你用的vs2005 那么一般来说 就没有但是如果你使用vs2005 又安装了 web application 并且创建的是 web application工程
    那么就有设计器代码了
      

  3.   

    你用的如果是 vs2003 就有这个设计器代码文件
    如果你用的vs2005 那么一般来说 就没有
    --------------
    你搞错了...VS2003没有VS2005才会有...这里说的是 Windows 应用程序...partial class 是VS2003不支持的...
      

  4.   

    [modifiers] partial type分部类型定义允许将类、结构或接口的定义拆分到多个文件中...