メモ帳C# Windowsフォームアプリのスケルトンコード
まずはFormクラスを継承したGameクラスを作成し、WindowsFormを表示させる。
using System; using System.Windows.Forms; class Game:Form { static void Main() { Application.Run( new Game()); } }
次にタイトルとサイズを変更してみる。
FormクラスのOnLoadメソッドを使うと、「フォームが初めて表示される直前に発生」する「load」イベントが発生するので、ここに書いてみる。
using System; using System.Drawing; using System.Windows.Forms; class Game:System.Windows.Forms.Form { protected override void OnLoad(EventArgs e ) { ClientSize = new Size(1280,720); Text="Game"; } static void Main() { Application.Run( new Game()); } }