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.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
DVVGmbH
Posts: 3
Last visit: Tue Oct 17, 2023 10:28 pm

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 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: Tue Oct 17, 2023 10:28 pm

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: Tue Oct 17, 2023 10:28 pm

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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 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.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked