Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using the MouseHover Event?

Posted on 2014-11-19
5
Medium Priority
?
123 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
  • 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

885 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