-
Jan 9th, 2018, 11:22 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Set Brush color same as form background (Control)
I need to set a brush color to the same as a form background which is currently set to Control.
All I see is brushes.<some color> which doesn't have what I need.
-
Jan 9th, 2018, 11:29 AM
#2
Re: Set Brush color same as form background (Control)
You have to go in a little bit of a circle to do that.
Control is a "system color" because there are system settings the user can change that define what color it is. It has a default we're all used to, but that it can change means you can't use a constant color like "grey" even if 99% of people use grey.
If you need a system color, you use the SystemColors class instead of the Colors class. Likewise, if you need a system brush, you use the SystemBrushes class instead of Brushes.
Code:
Dim controlBrush As SolidBrush = SystemBrushes.Control
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Jan 9th, 2018, 11:37 AM
#3
Thread Starter
Addicted Member
Re: Set Brush color same as form background (Control)
Originally Posted by Sitten Spynne
You have to go in a little bit of a circle to do that.
Control is a "system color" because there are system settings the user can change that define what color it is. It has a default we're all used to, but that it can change means you can't use a constant color like "grey" even if 99% of people use grey.
If you need a system color, you use the SystemColors class instead of the Colors class. Likewise, if you need a system brush, you use the SystemBrushes class instead of Brushes.
Code:
Dim controlBrush As SolidBrush = SystemBrushes.Control
That works just fine, thank you for that!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|