Solved

MouseMove Event

Posted on 1998-08-11
2
155 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

730 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