Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MouseMove Event

Posted on 1998-08-11
2
154 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Title # Comments Views Activity
VB error "Type mismatch" 2 60
VBA: Select SQL query based on a config Sheet v2 11 49
How to make an ADE file by code? 11 94
RUNRMTCMD from AS/400 12 68
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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