Checkbox flatappearance.checkedbackcolor didn't work

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
DVVGmbH
Posts: 3
Last visit: Mon Dec 20, 2021 2:14 am

Checkbox flatappearance.checkedbackcolor didn't work

Post by DVVGmbH »

Powershell

$checkbox1.flatstyle = 'flat'
$checkbox1.flatappearance.checkedbackcolor = 'green'

I use the Sapien Powershell Studio 2020.
Nothing changed when I configure the second line.
The same with this code:
$checkbox1.flatappearance.checkedbackcolor = [system.drawing.color]::fromARGB(255,...)
jvierra
Posts: 15044
Last visit: Fri Jan 21, 2022 12:42 am
Answers: 16
Has voted: 3 times
Been upvoted: 13 times

Re: Checkbox flatappearance.checkedbackcolor didn't work

Post by jvierra »

You can't change the color after the checkbox has been displayed. Set the color in the properties of the control.
DVVGmbH
Posts: 3
Last visit: Mon Dec 20, 2021 2:14 am

Re: Checkbox flatappearance.checkedbackcolor didn't work

Post by DVVGmbH »

Hi jvierra,
thanks for your answer.
The problem ist, that there ist no effect, when I configured it in the "Designer"-Area of the Powershell Studio. It is no problem to Change the "FlatStyle" to "Flat", but the "FlatAppearance" didn't work.
I hope, you understand me, my english ist not so good...
Best regards
Ralf.
DVVGmbH
Posts: 3
Last visit: Mon Dec 20, 2021 2:14 am

Re: Checkbox flatappearance.checkedbackcolor didn't work

Post by DVVGmbH »

... I can change the "checkedbackcolor", but when I start the script, there is not the new color.
jvierra
Posts: 15044
Last visit: Fri Jan 21, 2022 12:42 am
Answers: 16
Has voted: 3 times
Been upvoted: 13 times

Re: Checkbox flatappearance.checkedbackcolor didn't work

Post by jvierra »

Please read the following link very carefully. Be aware that the backcolor of the Checkbox is dynamic and sets only when the CheckBox is checked AND COMMITED
https://stackoverflow.com/questions/544 ... or-uncheck.
Locked