Skip to content

Instantly share code, notes, and snippets.

@sayurin
Created January 31, 2014 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayurin/8732064 to your computer and use it in GitHub Desktop.
Save sayurin/8732064 to your computer and use it in GitHub Desktop.
#r "System.Drawing.dll"
#r "System.Windows.Forms.dll"
open System.Drawing
open System.Windows.Forms
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault false
let form = new Form(ClientSize = Size(284, 261), Text = "ダイアログジェネレーター")
let caption = new TextBox(Location = Point(13, 13), Size = Size(259, 19), Anchor = (AnchorStyles.Top ||| AnchorStyles.Left ||| AnchorStyles.Right))
let text = new TextBox(Location = Point(13, 39), Size = Size(259, 133), Anchor = (AnchorStyles.Top ||| AnchorStyles.Left ||| AnchorStyles.Right), Multiline = true)
let combo = new ComboBox(Location = Point(13, 181), Size = Size(121, 20), DropDownStyle = ComboBoxStyle.DropDownList, FormattingEnabled = true)
combo.Items.AddRange [| MessageBoxButtons.OK; MessageBoxButtons.OKCancel; MessageBoxButtons.YesNo; MessageBoxButtons.YesNoCancel |]
let button = new Button(Location = Point(196, 179), Size = Size(75, 23), Anchor = (AnchorStyles.Top ||| AnchorStyles.Right), Text = "生成", UseVisualStyleBackColor = true)
button.Click.Add(fun _ -> MessageBox.Show(text.Text, caption.Text, combo.SelectedItem :?> MessageBoxButtons) |> ignore)
form.Controls.AddRange [| caption :> Control; text :> Control; combo :> Control; button :> Control |]
form.Controls.Add text
form.PerformLayout()
Application.Run form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment