Skip to content

Instantly share code, notes, and snippets.

@n-fukuju
Created January 19, 2014 02:48
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 n-fukuju/8499843 to your computer and use it in GitHub Desktop.
Save n-fukuju/8499843 to your computer and use it in GitHub Desktop.
PowerShellで、Formのイベントハンドリング。 (PowerShell 2.0で確認)
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$form = New-Object System.Windows.Forms.Form
$form.StartPosition = [Windows.Forms.FormStartPosition]::CenterScreen
$button = New-Object System.Windows.Forms.Button
$button.Text = "Exit"
$button.Add_Click({ $form.Close() }) # <= これ
$form.Controls.Add($button)
$form.ShowDialog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment