Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi Everyone,

I am playing around in VB by making my own controls by Inheriting objects such as Buttons. I am new to creating custom controls, and wonder if anybody can help me.

I have created a custom button, and given it a background image.

Now normally buttons in windows when you hover your mouse over a button the button changes - such as a change in picture or colour.

We can recreate a similar effect by overriding the onMouseHover event, and changing the background image to another image to get a hovered effect which is fine, however when using the onMouseHover event I have found it is much slower at changing the picture than a normal button.

This makes me to believe that the onMouseHover event is not suitable or the correct for this event. I.E. To make the button change appearance depending on the button state (hovered).

What do I override or change, to recreate the speed at which the button changes appearance depending on the state of the button?
Posted

1 solution

Mouse Hover is a slow event - it has to be because it is only triggered after the mouse has been stationary over the object for a small period of time.
It you want an immediate effect, then you need to look at the MouseEnter and MouseLeave events instead!
 
Share this answer
 
Comments
Willtwinny 27-Oct-12 14:26pm    
Thank-you ever so much.
I can't believe it was something as simple as that!
I should've known that but it is me being stupid as always.
Thanks once again :D
OriginalGriff 28-Oct-12 4:18am    
That's not stupid!
That's just ignorance - we all start out with that.
The difference is, ignorance can be cured... :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900