Changing Colours of Button

  • Thread starter Thread starter Atif Hasan
  • Start date Start date
A

Atif Hasan

I want to change the colour of Button on Form when i roll over the mouse or
click the button. is there any coding required for this? please help
 
--
Atif Hasan


KenSheridan via AccessMonster.com said:
To change the button's ForeColor property from black to red for instance, in
the button's MouseMove event procedure put:

Me.[YourButtonName].ForeColor = vbRed

Add another button to the form and size in so that it is bigger than the
original button. Set its Transparent property to true. Move it so that it
overlies the original button and place it behind the original button using
'Send to Back' on the Format menu. In design view you should now see part of
the second button surrounding the original, but in form view the second
button will be invisible.

In the second button's MouseMove event procedure put:

Me.[YourButtonName].ForeColor = vbBlack


To cater for moving focus to the button with the keyboard, in the original
button's GotFocus event procedure out:

Me.[YourButtonName].ForeColor = vbRed

And in its LostFocus event procedure put:

Me.[YourButtonName].ForeColor = vbBlack


In each case YourButtonName is the name of the original button.

Ken Sheridan
Stafford, England

Atif said:
I want to change the colour of Button on Form when i roll over the mouse or
click the button. is there any coding required for this? please help

--
Message posted via AccessMonster.com


.
Thanks for your help, i will try it hope it works thanks again
 
Back
Top