PC Review


Reply
Thread Tools Rate Thread

Changing color of a control

 
 
Colin McGuire
Guest
Posts: n/a
 
      7th Dec 2003
Hi, according to the on-line documentation you can change the
background colour of, for example a button, to Gray as shown below.

Dim b as Button
b.BackColor=Color.Gray

If I programmatically want to change the background colour of a button
to the default background colour for controls, it may or may not be
grey (depending on the preferences, eg Windows Classic style vs.
Windows XP style or a customised style may have changed the default
colouts). So how do you retrieve the default background colour for
controls ?
Thank you
Colin
 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      7th Dec 2003
Hi,

Button1.BackColor = SystemColors.Control



Ken
------------------------
"Colin McGuire" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, according to the on-line documentation you can change the
> background colour of, for example a button, to Gray as shown below.
>
> Dim b as Button
> b.BackColor=Color.Gray
>
> If I programmatically want to change the background colour of a button
> to the default background colour for controls, it may or may not be
> grey (depending on the preferences, eg Windows Classic style vs.
> Windows XP style or a customised style may have changed the default
> colouts). So how do you retrieve the default background colour for
> controls ?
> Thank you
> Colin



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      7th Dec 2003
* (E-Mail Removed) (Colin McGuire) scripsit:
> So how do you retrieve the default background colour for
> controls ?


'SystemColors.*', in your case 'SystemColors.Control'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the background color of a control Abay Microsoft Access Forms 2 13th Jul 2009 02:06 AM
Changing color of the tab control Marcus Microsoft Access 1 12th Dec 2008 09:06 AM
Changing Color Attributes for a Control Dynamically =?Utf-8?B?Smlt?= Microsoft Access Reports 1 30th Sep 2007 11:01 PM
Changing the color of days on a calendar control =?Utf-8?B?VGlnZXIgSGVsaQ==?= Microsoft Access VBA Modules 0 2nd May 2007 06:16 AM
Changing control enabled color AllenF Microsoft C# .NET 1 2nd Sep 2003 04:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:15 PM.