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