Solved

Using the MouseHover Event?

Posted on 2014-11-19
5
114 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 85

Accepted Solution

by:
Mike Tomlinson earned 250 total points
Comment Utility
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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
Comment Utility
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 250 total points
Comment Utility
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
Comment Utility
Ah Ok....my mistake...I thought the MouseEnter Event fired when the button was clicked.

Thanks guys for your help!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now