windowform background color to rgb or hex value

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 forum is a space to discuss coding involving Graphical User Interfaces (GUI) in PowerShell or using WinForms controls, and technical issues related to development.

- Question about a licensed SAPIEN product? Post here: Product Support for Registered Users
- Question about a trial SAPIEN product? Post here: Former and Future Customers - Questions
This topic is 5 months and 2 weeks 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
User avatar
ocsscott6969
Posts: 49
Last visit: Mon Jun 10, 2024 2:42 pm

windowform background color to rgb or hex value

Post by ocsscott6969 »

I was given rgb and hex values and can't find how to set the form backcolor to either of those values

unrelated but also is there a way in a text string being displayed on a label control to Bold just 1 word

Thanks so much
User avatar
brittneyr
Site Admin
Posts: 1824
Last visit: Thu Dec 12, 2024 8:05 am
Answers: 45
Been upvoted: 36 times

Re: windowform background color to rgb or hex value

Post by brittneyr »

You can get set rbg colors using code similar to the following:
  1. $Form.BackColor = [System.Drawing.Color]::FromArgb([int],[int],[int])
You can set hex colors using the following:
  1. $Form.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#161616")
These lines placed in the load of the form.

You cannot bold just one word in a label with just PowerShell.
Brittney
SAPIEN Technologies, Inc.
This topic is 5 months and 2 weeks 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