Forum Discussion

kpraveen_1219's avatar
kpraveen_1219
Copper Contributor
May 31, 2021

code

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()

$Form = New-Object system.Windows.Forms.Form
$Form.ClientSize = New-Object System.Drawing.Point(731,439)
$Form.text = "Form"
$Form.TopMost = $false

$CheckBox1 = New-Object system.Windows.Forms.CheckBox
$CheckBox1.text = "checkBox"
$CheckBox1.AutoSize = $false
$CheckBox1.width = 95
$CheckBox1.height = 20
$CheckBox1.location = New-Object System.Drawing.Point(45,78)
$CheckBox1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$CheckBox2 = New-Object system.Windows.Forms.CheckBox
$CheckBox2.text = "checkBox"
$CheckBox2.AutoSize = $false
$CheckBox2.width = 95
$CheckBox2.height = 20
$CheckBox2.location = New-Object System.Drawing.Point(175,78)
$CheckBox2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$RadioButton1 = New-Object system.Windows.Forms.RadioButton
$RadioButton1.text = "radioButton"
$RadioButton1.AutoSize = $true
$RadioButton1.width = 104
$RadioButton1.height = 20
$RadioButton1.location = New-Object System.Drawing.Point(45,192)
$RadioButton1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$RadioButton2 = New-Object system.Windows.Forms.RadioButton
$RadioButton2.text = "radioButton"
$RadioButton2.AutoSize = $true
$RadioButton2.width = 104
$RadioButton2.height = 20
$RadioButton2.location = New-Object System.Drawing.Point(173,192)
$RadioButton2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)

$ListBox1 = New-Object system.Windows.Forms.ListBox
$ListBox1.text = "listBox"
$ListBox1.width = 196
$ListBox1.height = 152
$ListBox1.location = New-Object System.Drawing.Point(40,268)

$Form.controls.AddRange(@($CheckBox1,$CheckBox2,$RadioButton1,$RadioButton2,$ListBox1))

 


#Write your logic code here

[void]$Form.ShowDialog()

Resources