I have a basic form UI in powershell. I have a series of 3 individual checkboxes with the following code:
$CBlabel = New-Object System.Windows.Forms.Label
$CBlabel .Location = New-Object System.Drawing.Point(10,125)
$CBlabel .Size = New-Object System.Drawing.Size(280,20)
$CBlabel .Text = "Select a box:"
$form.Controls.Add($CBlabel )
$cb1Checkbox = New-Object System.Windows.Forms.Checkbox
$cb1Checkbox .Location = New-Object System.Drawing.Size(10,145)
$cb1Checkbox .Size = New-Object System.Drawing.Size(280,20)
$cb1Checkbox .Text = "Checkbox 1"
$form.Controls.Add($cb1Checkbox )
$cb2Checkbox = New-Object System.Windows.Forms.Checkbox
$cb2Checkbox .Location = New-Object System.Drawing.Size(10,165)
$cb2Checkbox .Size = New-Object System.Drawing.Size(280,20)
$cb2Checkbox .Text = "Checkbox 2"
$form.Controls.Add($cb2Checkbox )
$cb3Checkbox = New-Object System.Windows.Forms.Checkbox
$cb3Checkbox .Location = New-Object System.Drawing.Size(10,185)
$cb3Checkbox .Size = New-Object System.Drawing.Size(280,20)
$cb3Checkbox .Text = "Checkbox 3"
$form.Controls.Add($cb3Checkbox )
I would like to add a 4th checkbox below this that says "Select All" and have it be dynamic if possible. If I select it, it automatically selects checkboxes 1, 2, and 3. If I unselect checkbox 2 (or any other checkbox), it automatically unselects the "Select All" checkbox. Is this possible?
Aucun commentaire:
Enregistrer un commentaire