|
-
Jul 8th, 2004, 03:03 PM
#1
Thread Starter
Member
Text In Label
Hi,
I gotta quick question for you guys/gals. I have created a form and inside that form there are about 50 labels and right now when you click on that label a DOS prompt opens up and it does a certian task.
Now what I would like to do is. When the user put the mouse over that label I would like the text in that label turn blue like as if it's a hyperlink. How can I go about doing this ?
Thanks In Advance
ScarEye
-
Jul 8th, 2004, 03:06 PM
#2
Addicted Member
you could always use the trusty mousemove feature.
Private Sub Label1_MouseMove(...)
label1.forecolor = vbblue
End Sub
But u would have to turn the colour to its original when u moved the mouse off it.
-
Jul 8th, 2004, 03:24 PM
#3
Thread Starter
Member
Psychotic,
If you don't mind me asking, what would the code be
to have it go back to it's orginal color when the mouse is moved ?
Thanks
ScarEye
-
Jul 8th, 2004, 03:30 PM
#4
Addicted Member
there could be a better way to do it but heres a quick example.....(I assumed u have a control array since u have roughly 50 labels on the form)
VB Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
For X = 0 To 9
Label1(X).ForeColor = vbBlack
Next X
End Sub
Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1(Index).ForeColor = vbBlue
End Sub
edit:
You could store the index of the one that got the mouse move in a variable and then when the user moves over somthing else such as the form, u could set only the label in the variable back to the original forecolor.
-
Jul 8th, 2004, 04:41 PM
#5
Thread Starter
Member
"(I assumed u have a control array since u have roughly 50 labels on the form)"
You assumed correctly. And this code worked perfectly.
Thank you very much.. =)
ScarEye
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|