Solved

MouseMove Event

Posted on 1998-08-11
2
151 Views
Last Modified: 2010-04-30
I've got a series of buttons on a form.  I want the buttons BackColor proprty to change from default gray to red when the user's mouse moves over the button.  The buttons' Style is set to Graphical.  I know how to make the button change colors once, but not change back to default gray when its NOT selected.
Private Sub cmdButton1_MouseMove(Button As Integer, Shift

As Integer, X As Single, Y As Single)
cmdButton1.BackColor = &HC0FFFF

End Sub

Changes the background color of the button when the mouse is over it.  Anyone got an idea?

BTW - The buttons are NOT in an array.  They are all named separately (for a reason).
Thanks..
0
Comment
Question by:EvanL
2 Comments
 
LVL 1

Accepted Solution

by:
jsuper earned 60 total points
ID: 1468557
Well,  It will talk a bit of coding, but I would use the object_mousemove events for all of the OTHER controls on he form as well as the form.   If the mouse is being moved over any other objects, then you know the mouse is not ove rany of the command buttons.  For example, let's say the only ojbects on the form are the command buttons.   Then I would add the following event code...

Private Sub Form1_MouseMove(Button As Integer, Shift   As Integer, X As Single, Y As Single)
   cmdButton1.BackColor =   (Original Color)
   cmdButton2.BackColor =   (Original Color)
End Sub

If there are any other controls on the form, Add the same code to those events.   In fact, I would probably create a Reset_Color subroutine and just call the subroutine in each event.  I must admit,  I haven't tried this, but it should work in theory...
0
 
LVL 1

Author Comment

by:EvanL
ID: 1468558
not sure why I couldn't think of this..  no caffeine this AM..

thanks for the answer..  quite easy..

word to anyone "buying" this question.. It is much faster to highlight a command button using a font property (fontitalic, fontunderline, fontbold) than to make the button change colors..

best..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now