Archive for 6月 15th, 2012
-
Hello, Windows Forms(Nemerle) World!
Posted on 6月 15th, 2012 by cx20
Windows Forms(Nemerle)
Windows フォーム(Windows Forms)は .NET Framework におけるユーザーインターフェイス基盤である。Windows アプリケーションにおけるウィンドウやダイアログに対応する。
以下は Nemerle における Windows フォーム の例となっている。ソースコード
using System.Drawing; using System.Windows.Forms; class HelloForm : Form { public this() { Size = Size( 640, 480 ); Text = "Hello, World"; def label1 = Label(); label1.Size = Size( 320, 20 ); label1.Text = "Hello, Windows Forms(Nemerle) World!"; Controls.Add( label1 ); } public static Main() : void { def form = HelloForm(); Application.Run( form ); } }
実行方法
C:¥> ncc -o hello -target:winexe -r:System.Windows.Forms hello.n
実行結果
+------------------------------------------+ |Hello, World! [_][~][X]| +------------------------------------------+ |Hello, Windows Forms(Nemerle) World! | | | | | | | | | | | | | | | | | | | +------------------------------------------+