Sunday, November 7, 2021

Adding a Checkbox into a Powershell GUI

 To add a checkbox into the GUI form do the following:

$chkAutoClear = New-Object System.Windows.Forms.CheckBox
$chkAutoClear.Text = "This is the name of the text shown"
$chkAutoClear.Location = New-Object System.Drawing.Size(440,140)
$chkAutoClear.Size = New-Object System.Drawing.Size(200,30)
$chkAutoClear.BackColor = "Transparent"
$chkAutoClear.Font = New-Object System.Drawing.Font("Arial",10,[System.Drawing.FontStyle]::Regular)
$chkAutoClear.Checked = $true

Size is x=200, y=30

Location is x=440, y=140

No comments: