Setting a control's backcolor to a system color in code 
Author Message
 Setting a control's backcolor to a system color in code

I want to set the backcolor of a control to the System
Window color.  When you pick a color in the designer, you
can choose between 3 tabs: Custom, Web, and System.

I am able to access the web colors in code:
Example:
txtTest.BackColor = Color.White

However, I want to access the System colors in code so
that I can set the backcolor to the System Window color.

How can this be done?

Thanks,

Joanna



Sat, 16 Oct 2004 23:48:55 GMT  
 Setting a control's backcolor to a system color in code

Quote:

> I want to set the backcolor of a control to the System
> Window color.  When you pick a color in the designer, you
> can choose between 3 tabs: Custom, Web, and System.

> I am able to access the web colors in code:
> Example:
> txtTest.BackColor = Color.White

> However, I want to access the System colors in code so
> that I can set the backcolor to the System Window color.

> How can this be done?

Try this:  txtText.BackColor = SystemColors.Control

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net



Sun, 17 Oct 2004 00:06:14 GMT  
 Setting a control's backcolor to a system color in code
Perfect.  Thank you!

Quote:
>-----Original Message-----

>> I want to set the backcolor of a control to the System
>> Window color.  When you pick a color in the designer,
you
>> can choose between 3 tabs: Custom, Web, and System.

>> I am able to access the web colors in code:
>> Example:
>> txtTest.BackColor = Color.White

>> However, I want to access the System colors in code so
>> that I can set the backcolor to the System Window color.

>> How can this be done?

>Try this:  txtText.BackColor = SystemColors.Control

>--
>Jacob Grass
>Microsoft .NET MVP
>Check out http://windowsforms.net

>.



Sun, 17 Oct 2004 00:32:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. setting all foreground and bkground colors to use window's current color setting

2. backcolor property on SSTab control doesn't change backcolor

3. Compare a TextBox Backcolor with a System.Drawing.Color

4. Setting Tabstrips 'backcolor'

5. Setting an ADO Control's settings witin Code

6. Backcolor won't change with all color selections

7. Set Textbox BackColor to Ambient BackColor

8. Control's BackColor Based on Field's Required Property

9. How to set color coding w/o using code behind

10. Setting the backcolor of all my controls

11. How to set BackColor property for SSTab control

12. Need help setting backcolor property of command button control in VB5

 

 
Powered by phpBB® Forum Software