Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using the MouseHover Event?

Posted on 2014-11-19
5
Medium Priority
?
122 Views
Last Modified: 2014-11-20
I have a Windows Form that have a lot of Buttons on it. I want to be able to change the default color to another color when the Mouse hovers over a button and then have the default color restored when the Mouse isn't over the button. I can do it when the Mouse is hovering over a button but not sure how to handle it when it's NOT over a button. Are there events for when the Mouse isn't hovering or do I need to create custom code?

Thanks!
0
Comment
Question by:BlakeMcKenna
[X]
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
  • 2
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 40453947
0
 
LVL 40
ID: 40454187
MouseHover is not a good choice for what you do, because it triggers continuously while the cursor is over the control.

Instead, change the BackColor on MouseEnter, and reset it to its original value on MouseLeave.
0
 

Author Comment

by:BlakeMcKenna
ID: 40454951
James,

What I'm wanting to do is give the user a visual representation of when a certain button is enabled. So, I'm thinking that when a button IS enabled and the mouse hovers over it....it will change to the specified color. Doesn't the MouseEnter Event fire when the button is clicked on or the button has focus and the Enter key is pressed?
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 40455083
No, the MouseEnter event triggers when the cursors enters the surface of the button.

Then there are MouseHover events at regular intervals as long as the cursors stays over the button.

Finally there is a MouseLeave when the cursor leaves the surface of the button and goes on the form or another control.

No need to click.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40455113
Ah Ok....my mistake...I thought the MouseEnter Event fired when the button was clicked.

Thanks guys for your help!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

704 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