This code:
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
# set form size
$Form = New-Object System.Windows.Forms.Form
$Form.width = 500
$Form.height = 500
$Form.Text = ”Install Software”
# set font
$Font = New-Object System.Drawing.Font("Verdana",10)
$Form.Font = $Font
# checkbox 7-zip
$checkbox1 = new-object System.Windows.Forms.checkbox
$checkbox1.Location = new-object System.Drawing.Size(30,30)
$checkbox1.Size = new-object System.Drawing.Size(120,20)
$checkbox1.Text = " 7-Zip"
$checkbox1.Checked = $false
$Form.Controls.Add($checkbox1)
# checkbox notepad ++
$checkbox2 = new-object System.Windows.Forms.checkbox
$checkbox2.Location = new-object System.Drawing.Size(30,50)
$checkbox2.Size = new-object System.Drawing.Size(120,20)
$checkbox2.Text = " Notepad ++"
$checkbox2.Checked = $false
$Form.Controls.Add($checkbox2)
# ok button
$OKButton = new-object System.Windows.Forms.Button
$OKButton.Location = new-object System.Drawing.Size(130,400)
$OKButton.Size = new-object System.Drawing.Size(100,40)
$OKButton.Text = "OK"
$OKButton.Add_Click({$Form.Close()})
$form.Controls.Add($OKButton)
# cancel button
$CancelButton = new-object System.Windows.Forms.Button
$CancelButton.Location = new-object System.Drawing.Size(255,400)
$CancelButton.Size = new-object System.Drawing.Size(100,40)
$CancelButton.Text = "Cancel"
$CancelButton.Add_Click({$Form.Close()})
$form.Controls.Add($CancelButton)
$OKButton.Add_Click{
if($checkbox1.Checked) {Start-Process -FilePath C:\software\7z1900-x64.exe /S}
if($checkbox2.Checked) {Start-Process -FilePath C:\software\npp.7.8.1.Installer.x64.exe /S}
}
# activate form
$Form.Add_Shown({$Form.Activate()})
[void] $Form.ShowDialog()
(This is just an example of script, don’t try to fix it)
I would like to add many checkboxes to the GUI, but I don’t want to make the window larger, I want to make it so it stays the same size, but I will have the option to scroll if I have too many entries, it will look something like this (used paint to edit)::
So in short summery:
A GUI that has many checkboxes which the user can scroll from