Results 1 to 2 of 2

Thread: [RESOLVED] cursors

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Resolved [RESOLVED] cursors

    i would like my picture boxes and labels to act like hyperlinks, so it has the hand icon when i move the mouse over it. i have noticed that you cant use the mouse drag because you cant click

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: cursors

    I usually use textboxes, but I don't see why you couldn't use a picturebox (you will not be able to use a Label because the label control does not have an hWnd property.)

    In the pictureboxs property page set the mouse pointer to 99-Custom
    In the mouseicon property load the picture that you want to use. Then add this code to the mouseover event
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SetCapture Lib "User32" (ByVal hwnd As Long) As Long
    4. Private Declare Function ReleaseCapture Lib "User32" () As Long
    5. Private Declare Function GetCapture Lib "User32" () As Long
    6.  
    7. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8. If (X < 0) Or (Y < 0) Or (X > Picture1.Width) Or (Y > Picture1.Height) Then
    9.        ReleaseCapture
    10. ElseIf GetCapture() <> Picture1.hwnd Then
    11.        SetCapture Picture1.hwnd
    12. End If
    13. End Sub
    Place whatever code is necessary in the pictureboxes click event.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width