唐突にF#

#light

open System
open System.Windows.Forms

type TestForm = class
    inherit Form as base

    val btn: Button

    member this.btn_Click(_) =
        MessageBox.Show("!") |> ignore

    new() as this =
    {
        inherit Form(
            Text = "TestForm",
            Width = 120,
            Height = 80
        );
        btn = new Button(
            Text = "?",
            Top = 8,
            Left = 8,
            Anchor = AnchorStyles.Right + AnchorStyles.Top) }
    then
        this.btn.Click.Add(this.btn_Click);
        this.Controls.Add(this.btn);
end;;

#if COMPILED
do Application.Run(new TestForm());;
#endif

うにゅー.やっぱりフォームデザイナのないVSは使いにくいな