PC Review


Reply
Thread Tools Rate Thread

default button gray color

 
 
Peted
Guest
Posts: n/a
 
      2nd May 2007
I have a winform in c#, with some default buttons.
The default face color of these buttons is a nice shade of light grey,
basicly the default button color you see on ms apps.

I want the button to go color red when it is depressed and return to
the nice grey shade it has when it is up

i know how to change the colors, but i cant find in Colors or in
SystemColors the correct shade of grey.

What is it ? If i use the Systemcolors.Control or buttonface greys,
they are not the color im looking for

Im thinking its a grey from XP user preferences for each pc, how can i
set it back to this ?


thanks for any help

Peted
 
Reply With Quote
 
 
 
 
Peted
Guest
Posts: n/a
 
      2nd May 2007
On Wed, 02 May 2007 11:14:29 +0800, Peted wrote:

Let me correct slightly what i posted, im using check boxs with the
appearence set to "button", but i still have the problem bellow

thanks

Peted



>I have a winform in c#, with some default buttons.
>The default face color of these buttons is a nice shade of light grey,
>basicly the default button color you see on ms apps.
>
>I want the button to go color red when it is depressed and return to
>the nice grey shade it has when it is up
>
>i know how to change the colors, but i cant find in Colors or in
>SystemColors the correct shade of grey.
>
>What is it ? If i use the Systemcolors.Control or buttonface greys,
>they are not the color im looking for
>
>Im thinking its a grey from XP user preferences for each pc, how can i
>set it back to this ?
>
>
>thanks for any help
>
>Peted


 
Reply With Quote
 
jblivingston@gmail.com
Guest
Posts: n/a
 
      2nd May 2007
On May 1, 11:14 pm, Peted wrote:
> i know how to change the colors, but i cant find in Colors or in
> SystemColors the correct shade of grey.
>

In my opinion, you would be better off preserving the up color and
restoring it rather than hard-coding it in multiple places. On a form
that you have defined event handlers for both the MouseUp and
MouseDown events, you can do something similar to the following:

Color upColor;
Color downColor = Color.Red;
private void button1_MouseDown(object sender, MouseEventArgs e)
{
Button button = sender as Button;
this.upColor = button.BackColor;
button.BackColor = this.downColor;
}

private void button1_MouseUp(object sender, MouseEventArgs e)
{
button1.BackColor = this.upColor;
}


> thanks for any help
>


I hope my suggestions were helpful.

John

P.S. This tactic will work with most controls

 
Reply With Quote
 
Peted
Guest
Posts: n/a
 
      2nd May 2007
On 1 May 2007 21:05:14 -0700, (E-Mail Removed) wrote:

Hi thanks for your help.

the technique you show here is more efficient to what i was doing,
however it still has the same problem.

The color that is restored on the "up" is not the same light grey
shade of the button face, before the button was clicked. The grey is
darker same as the form background

The only thing i can think of is that the "use visualstyles" options
are not overriding the color of the button, like they should

any ideas would be helpfull

thanks





>On May 1, 11:14 pm, Peted wrote:
>> i know how to change the colors, but i cant find in Colors or in
>> SystemColors the correct shade of grey.
>>

>In my opinion, you would be better off preserving the up color and
>restoring it rather than hard-coding it in multiple places. On a form
>that you have defined event handlers for both the MouseUp and
>MouseDown events, you can do something similar to the following:
>
> Color upColor;
> Color downColor = Color.Red;
> private void button1_MouseDown(object sender, MouseEventArgs e)
> {
> Button button = sender as Button;
> this.upColor = button.BackColor;
> button.BackColor = this.downColor;
> }
>
> private void button1_MouseUp(object sender, MouseEventArgs e)
> {
> button1.BackColor = this.upColor;
> }
>
>
>> thanks for any help
>>

>
>I hope my suggestions were helpful.
>
>John
>
>P.S. This tactic will work with most controls


 
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
Change Gray field color to another color in a form Jugglertwo Microsoft Word Document Management 5 27th Oct 2010 10:14 AM
set default font color button Lance in California Microsoft Excel Misc 0 28th May 2009 06:13 PM
RE: Change default background color from dark gray to black? taycat123 Windows XP MovieMaker 1 16th Aug 2008 09:39 PM
How can I change font color of Subject from default value (gray) to something else? savas_karaduman@yahoo.com Microsoft Outlook Discussion 1 19th Jan 2007 04:26 PM
The BACKGROUND COLOR OF THE COMMAND BUTTON FACES RESET TO THE DEFAULT COLOR Alva Dean Microsoft Excel Programming 2 8th Mar 2004 08:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 AM.