Solved

Using the MouseHover Event?

Posted on 2014-11-19
5
116 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
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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Code enhancement 5 22
Round a string to two digits 12 31
update textboxes with Streamreader 21 42
Access to class from any project within a solution. 6 14
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

20 Experts available now in Live!

Get 1:1 Help Now