目次: C# - Windows Formsでよく使うコントロールたち (Visual Studioなし環境向け) - Qiita
画面キャプチャ
テンプレ
using System;
using System.Drawing;
using System.Windows.Forms;
class ButtonSample:Form
{
ButtonSample()
{
var button = new Button(){
Location = new Point(10, 10),
Size = new Size(150, 25),
Text = "push",
};
Controls.Add(button);
button.Click += ButtonClick;
// button.Click += (sender,e)=>{MessageBox.Show("clicked!");};
}
void ButtonClick(object sender, EventArgs e)
{
MessageBox.Show("clicked!");
}
[STAThread]
static void Main()
{
Application.Run(new ButtonSample());
}
}