-
Notifications
You must be signed in to change notification settings - Fork 1
/
Start-GUITest.ps1
40 lines (30 loc) · 1.45 KB
/
Start-GUITest.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Add-Type -AssemblyName System.Windows.Forms
$form = [System.Windows.Forms.Form]::new()
$form.Width = 800
$form.Height = 600
$btnClose = [System.Windows.Forms.Button]::new()
$btnClose.Text = "Close"
$btnClose.Parent = $form
$btnClose.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
$btnClose.FlatStyle = [System.Windows.Forms.FlatStyle]::System
$btnClose.Location = [System.Drawing.Point]::new($form.Width - 100, $form.Height - 70)
$btnHehe = [System.Windows.Forms.Button]::new()
$btnHehe.Text = "Hehehe"
$btnHehe.Parent = $form
$btnHehe.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
$btnHehe.FlatStyle = [System.Windows.Forms.FlatStyle]::System
$btnHehe.Location = [System.Drawing.Point]::new($form.Width - 190, $form.Height - 70)
$textbox = [System.Windows.Forms.RichTextBox]::new()
$textbox.Parent = $form
$textbox.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right -bor [System.Windows.Forms.AnchorStyles]::Top
$textbox.Width = $form.Width - 16
$textbox.Height = $form.Height - 80
$textbox.Font = [System.Drawing.Font]::new([System.Drawing.FontFamily]::GenericMonospace, 10)
$btnHehe.add_Click({
$textBox.Clear()
$textBox.Text += Get-Process | Out-String
})
$btnClose.add_Click({
$form.Close()
})
$form.ShowDialog()