?
Solved

MouseMove Event

Posted on 1998-08-11
2
Medium Priority
?
160 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 240 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

809 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