Search Tools Links Login

VB6 Tutorial 31: MouseOver Effects


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.

About this post

Posted: 2018-04-15
By: vb6boy
Viewed: 2,906 times

Categories

Visual Basic 6

VB6 Tutorial

Attachments

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


Loading Comments ...

Comments

AnonymousCoward posted this comment on 2019-09-16:

Hi,

This is Khan Faizan how to implement effects in vb 6.0

Can anyone help me with this??

Thank You

 

dwirch posted this comment on 2019-09-16:

What effects are you attempting to implement? 

This project specifically demonstrates a mouseover effect, in that when hover over an element, in this case a button, an action results, such as making the shape behind the button visible.

This method can be applied to any number of items, for varying effects.

You must be logged in to make a comment.