Created
January 16, 2015 02:44
-
-
Save jclosure/b3c7b3c8e455533de1fb to your computer and use it in GitHub Desktop.
Use PowerShell to Create WinForms on the Fly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$firstName = New-Object System.Windows.Forms.textBox | |
$firstName.add_KeyUp({ $fullName.Text = $firstName.text + " " + $lastName.text}) | |
$lastName = New-Object System.Windows.Forms.textBox | |
$lastName.top += 50 | |
$lastName.add_KeyUp({ $fullName.Text = $firstName.text + " " + $lastName.text}) | |
$fullName = New-Object System.Windows.Forms.textBox | |
$fullName.top += 100 | |
Add-Type -AssemblyName System.Windows.Forms | |
$form = New-Object System.Windows.Forms.Form | |
$form.Text = "My First Form" | |
$form.controls.add($firstName) | |
$form.controls.add($lastName) | |
$form.controls.add($fullName) | |
$form.Add_Shown({ $form.Activate()}) | |
$form.ShowDialog() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment