VB6 Tutorial 31: MouseOver Effects

Posted On 2018-04-15 by VB6Boy
Keywords:
Tags: VB6 Tutorials 
Views: 40

Title Uploaded Size
MouseHover.zip 4/15/2018 6:17:44 AM 1,215


Looking for the more of the VB6 Tutorial? Here is the tutorial index.

In this lesson, I'm going to tell you about the Mouse Hover effects that you can achieve writing a few lines of code. In Visual Basic 6.0, there is no such event like mouse hover. But you can do it writing some lines of code.

The following lessons are helpful if you want to learn about events:

What is mouse hover effect?

The mouse hover technique is used in all the modern software applications as this is the key to enhancing the graphical user interface (GUI) of the software. This technique is found everywhere on the web too, in most of the websites.

When you hover your mouse pointer over an object in the software interface, the appearance of that object changes in a particular way, like the object grows bigger, the color changes, the text is enlarged or the object becomes brighter. This is what I mean by mouse hover effects.

As I mentioned before, there is no any inbuilt event in VB6 for mouse hover which is surely a limitation of the VB6 environment whereas the later versions of Visual Basic provides the MouseHover event giving a great advantage to the programmers. However you do not have to worry too much for this as you can achieve this with only a few lines of coding in VB6.

In Visual Basic 6.0, the mouse hover effect is achieved with the help of MouseMove event.

Example

When you hover on CommandButton, the button's font size increases in this example.

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.FontSize = 10
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.FontSize = 8
End Sub

When you move your mouse over the button, the shape behind it "lights up", something like this picture:

See the attached sample project for a method of simulating a hover effect.

Looking for the more of the VB6 Tutorial? Here is the tutorial index.


About the Author

has posted a total of 78 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.166.212.152

Before you can post, you need to prove you are human. If you log in, this test goes away.


Code Links