using System; using System.Windows.Forms; namespace DataGridView { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string message = textBox1.Text; MessageBox.Show(message); } private void button2_Click(object sender, EventArgs e) { string message = "こんにちは"; Console.WriteLine(message); } } }
06) public partial class Form1 : Form partial は、Form1 の定義が別にもある事を示す。 ※ Form1.Designer.cs がその片割れで、システムが画面定義を行っている Form1 : Form は Form クラスを継承した Form1 クラスである事を示す 08) public Form1() クラス名と同盟の public なメソッドはコンストラクタです。 InitializeComponent は、Form1.Designer.cs に定義されています ▼ タブの設定![]()