Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 793
  • Last Modified:

Events for a label

I want to have a VB6 label control function like a hyperlink. When the user moves the mouse over the lavbel, I want to change the mouse pointer. When they click on it, I will, in code, direct them to a page in a browser. When the user moves the mouse pointer out from over the label, I want to change the pointer back to the default.

Unfortunately, the label control only has a mousemove event (I can use that to determine when the control gets focus) but no way of determining when focus is lost. Any ideas???

Doug
0
dbbishop
Asked:
dbbishop
1 Solution
 
jmundsackCommented:
Why not just set the MousePointer property of the label to "99 - Custom" and set the MouseIcon property to a "pointing finger" cursor (available in the common graphics for Visual Studio)?
0
 
dbbishopAuthor Commented:
I can do that on MouseMove event because then I know the label has focus. But, I want to change it back to the default pointer when the label loses focus. There is no event that I am aware of that lets me know when that happens. If I move off the control, I just never call the mousemove event again. The only other option I know off is to use the mouse move events of the other controls around the label to reset the pointer to normal. I would rather do it all within the label control iteslf.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
You only need to set the properties jmundsack describes at design time. the mouse pointer will change automatically, no need to code anything.
0
 
vb_elmarCommented:
Needs :
=====
1 Label


Const URL = "whatismyip.com"

Private Sub Form_Load()
    With Label1
        .Font = "arial"
        .FontSize = 12
        .FontUnderline = True
        .Caption = URL
        .Width = 2000
    End With
End Sub



Public Sub gotoweb(ByVal myURL As String)
Dim Success As Long
Shell "C:\Programme\Internet Explorer\IEXPLORE.EXE " & myURL, vbNormalFocus
End Sub



Private Sub Label1_Click()
    gotoweb URL
End Sub
0
 
dbbishopAuthor Commented:
DUH! I left my brain at home this morning :-(
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now