Advertisement
hiro1357

forms_on_ps.ps1

Oct 27th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Add-Type -AssemblyName System.Windows.Forms
  2.  
  3. function button1_click() {
  4. [Windows.Forms.MessageBox]::Show("hello!")
  5. }
  6.  
  7. $form1 = New-Object System.Windows.Forms.Form
  8. $form1.Text = "greeting"
  9. $button1 = New-Object System.Windows.Forms.Button
  10. $button1.Text = "hello"
  11. $button1.Top = 100
  12. $button1.Left = 100
  13. $button1.Add_Click({button1_click})
  14. $form1.Controls.Add($button1)
  15. $form1.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement