開発環境 メモ帳
実行環境 Microsoft Windows 8.1 (64bit)

  • コンソールが不要ならばコンパイルオプションを付ける
csc /t:winexe FormTest.cs

参考

FormTest.cs
// FormTest.cs
 
using System;
using System.Drawing;
using System.Windows.Forms;
 
public class Form1 : Form
{
	private void InitializeComponent()
	{
		button1 = new Button();
		SuspendLayout();
 
		// button1
		button1.Location = new Point(100, 100);
		button1.Size = new Size(100, 25);
		button1.TabIndex = 1;
		button1.Text = "OK";
		button1.Click += new EventHandler(button1_Click);
 
		// Form1
		AcceptButton = button1;
		ClientSize = new Size(640, 480);
		Text = "Form1";
		Controls.Add(button1);
 
		ResumeLayout(false);
		PerformLayout();
	}
 
	private Button button1;
 
	public Form1()
	{
		InitializeComponent();
	}
 
	private void button1_Click(object sender, EventArgs e)
	{
		MessageBox.Show("hello, world", "FormTest");
	}
}
 
static class Program
{
	[STAThread]
	static void Main()
	{
		Application.Run(new Form1());
	}
}
 
最終更新:2014年03月26日 12:35