-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI_Window_Preset.ps1
85 lines (56 loc) · 4.61 KB
/
GUI_Window_Preset.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#*******************************
#Author: Jonathan Parrilla
#Created: M/D/Y
#Last Updated: M/D/Y
#*******************************
#Import the function(s) that are needed.
#Clear the console screen
Clear-Host
#Called in order to draw the GUI frame.
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
#****DEFINES THE GUI FRAME****#
#Creates a new form/frame
$GuiWindow = New-Object System.Windows.Forms.Form
#Title text for the frame
$GuiWindow.Text = "GUI TITLE TEXT"
#Size of the frame
#$iisResetGuiWindow.Size = New-Object System.Drawing.Size(350,310)
$GuiWindow.Size = New-Object System.Drawing.Size(800,600)
#Form/frame's start position.
$GuiWindow.StartPosition = "CenterScreen"
#****DEFINES A BUTTON****#
#Create button. Define location, size, text and its 'on-click' response.
$Button = New-Object System.Windows.Forms.Button
$Button.Location = New-Object System.Drawing.Size(160,540)
$Button.Size = New-Object System.Drawing.Size(75,23)
$Button.Text = "BUTTON"
$Button.Add_Click({})
#Add the button the GUI
$GuiWindow.Controls.Add($Button)
#****DEFINES A LABEL ****#
#Create the label. Define location, size, and text.
$Label = New-Object System.Windows.Forms.Label
$Label.Location = New-Object System.Drawing.Size(300,20)
$Label.Size = New-Object System.Drawing.Size(280,400)
$Label.Text = "LABEL TEXT"
#Add the lable to the GUI
$GuiWindow.Controls.Add($Label)
#****DEFINES A TEXT BOX TO INPUT SERVERS****#
#Create the box. Define its location and size.
$boxForServers = New-Object System.Windows.Forms.TextBox
$boxForServers.Location = New-Object System.Drawing.Size(10,40)
$boxForServers.Size = New-Object System.Drawing.Size(260,475)
#Set it to multiline, have it accept return key strokes, and scroll bars.
$boxForServers.multiline = $true
$boxForServers.AcceptsReturn = $true
$boxForServers.ScrollBars = 'Both'
#Add box to the GUI
$GuiWindow.Controls.Add($boxForServers)
#************* CREATING THE GUI *********************
#Make the GUI Window the Top most form.
$GuiWindow.Topmost = $True
#Activate the GUI window
$GuiWindow.Add_Shown({$GuiWindow.Activate()})
#Display the GUI Window
[void] $GuiWindow.ShowDialog()