Visual Basic & Mouse Over

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

bear

Thread Starter
Joined
Jan 1, 1999
Messages
110
Help,
I am needing some help in Mouse Over in Visual Basic 6. I am trying to have either labels or command buttons that are invisible, but when a mouse passes over it, they appear. I am really wanting to have the line control over a label, so when the user passes the mouse over it, the line will appear, then click on the line, with the label under it.
If anyone can stear me in the right direction, I would greatly appreciate it, and even some code would help. I am totally lost and confused!!!! :eek:

Thanks,

bear
 
Joined
Sep 29, 2007
Messages
54
It has been a while since I used VB but have you tried using something like

If MouseMove = true then
lablexyz.visible = true

or something of that nature (I forget what the syntax would be exactly). But, with that if the mouse is not moving but over the control the control would still be hidden.

I hope this gives you some ideas.
 

bear

Thread Starter
Joined
Jan 1, 1999
Messages
110
Thanks ver much for the idea. I must be in a slump, as I can not get anything to work. I will just have to worry it to death, until it works.
 
Joined
Aug 17, 2001
Messages
7,486
In order to have the command button show when the mouse is moved over it, you need to find out where the command button is located on the form. (Get the range for the X and Y coordinates of command1)

Here's a code sample I wrote for you of using the form's MouseMove event.
When the mouse is over the command button, the button is visible. When the mouse is moved away to another location, the command button again disappears.

Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, _
 X As Single, Y As Single)
Dim A As Single
Dim B As Single
A = Command1.Left + Command1.Width
B = Command1.Top + Command1.Height

 If X > Command1.Left And X < A _
 And Y > Command1.Top And Y < B Then
 Command1.Visible = True
 Else: Command1.Visible = False
 End If

 
End Sub
Also, this assumes you have set the command button's visible property to false in the IDE.
 

bear

Thread Starter
Joined
Jan 1, 1999
Messages
110
Thanks for your reply on the MouseOver routine. That is just what I was looking for. Thanks again

Bear
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top