新規プロジェクトを作成するとVisual Studio.Net 2003では
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
///
/// Form1 の概要の説明です。
///
public class Form1 : System.Windows.Forms.Form
{
///
/// 必要なデザイナ変数です。
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows フォーム デザイナ サポートに必要です。
//
InitializeComponent();
//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
}
///
/// 使用されているリソースに後処理を実行します。
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows フォーム デザイナで生成されたコード
///
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion
///
/// アプリケーションのメイン エントリ ポイントです。
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
それがVisual Studio 2005では3ファイルに分割されます。
EntryPoint.cs
using System;
using System.Windows.Forms;
namespace WindowsApplication1
{
static class EntryPoint
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
Form1.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
///
/// Summary description for form.
///
public partial class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
public Form1()
{
InitializeComponent();
}
}
}
Form1.Designer.cs
namespace WindowsApplication1
{
public partial class Form1 : System.Windows.Forms.Form
{
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300, 300);
this.Text = "Form1";
this.Padding = new System.Windows.Forms.Padding(9);
this.AutoSize = true;
}
///
/// Clean up any resources being used.
///
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
}
}
EntryPointは前々からそうなってほしいと思っていたのでいいとしてポイントはForm1です。
2003だと、いろいろと自動で挿入されるソースが入っているのですが2005だとシンプルになっています。
これで自分の作るソースとデザイナで設定されるソースが分割されるのでわかりやすいと思います。
でも、今のデザイナとかでデザイナ部分のソースを変更している途中の解釈失敗とかで消えてしまったりといったトラブルはこれによってより強まってしまわないか心配です。
このDesignerソース実は標準では見えない扱いで見えないファイルを表示するにしないといけません。
VSS2004もメインソースに繋がる子ファイルたちは比較できないし。(DataSetの.csファイルとかも一緒ね)
VSS2004のUTF-8対応ともどもWishした方がいいのかなーどうでしょう皆さん