Hello, Windows Forms(Oxygene) World!

Posted on 6月 16th, 2012 by cx20

Windows Forms(Oxygene)

Windows フォーム(Windows Forms)は .NET Framework におけるユーザーインターフェイス基盤である。Windows アプリケーションにおけるウィンドウやダイアログに対応する。
以下は Oxygene における Windows フォーム の例となっている。

ソースコード

namespace hello;
 
interface
uses
    System,
    System.Drawing,
    System.Windows.Forms;
 
type
    HelloForm = class(System.Windows.Forms.Form)
    public
        constructor;
        class method Main(args: array of String): Integer;
    end;
 
implementation
 
constructor HelloForm;
var
    label1: Label;
begin
    self.Size := new Size( 640, 480 );
    self.Text := "Hello, World!";
    label1 := new Label();
    label1.Size := new Size( 320, 20 );
    label1.Text := "Hello, Windows Forms(Oxygene) World!";
    self.Controls.Add( label1 );
end;
 
[STAThread] 
class method HelloForm.Main(args: array of String): Integer;
begin
    using form := new HelloForm do
    Application.Run(form);
end;
 
end.

実行方法

C:¥> oxygene Hello.pas ^
    -type:winexe ^
    -ref:System.dll;System.Drawing.dll;System.Windows.Forms.dll

実行結果

+------------------------------------------+
|Hello, World!                    [_][~][X]|
+------------------------------------------+
|Hello, Windows Forms(Oxygene) World!      |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
+------------------------------------------+

Tags:

Categories: .NET, Delphi, Oxygene, Windows Forms

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

WP-SpamFree by Pole Position Marketing