Results 1 to 6 of 6

Thread: Changing Mouse Pointer on Click until MouseUp

  1. #1
    Guest
    I'm using a picturebox as a custom button and I want to change the mouse pointer while the mouse is down.
    MouseMove is great, unless the user moves their cursor off of the control. I want the mouse pointer to be changed no matter where they move... until they release the button.

    Any Suggestions?

    Thanks,
    -Jordan

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Use the MousePointer property of the Picturebox, i.e.
    Code:
    Option Explicit
    
    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Picture1.MousePointer = vbHourglass
    End Sub
    
    Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Picture1.MousePointer = vbDefault
    End Sub

  3. #3
    Guest
    Thanks Aaron, how do I do it for a custom icon?

  4. #4
    Guest
    Set the Picture's MouseIcon to the Icon you desire. And change vbHourGlass to vbCustom.

    Code:
    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Picture1.MousePointer = vbCustom
    End Sub

  5. #5
    Guest
    Picture1.MousePointer = vbCustom doesnt work.. I'd like to try to get the Custom icon associated with the mouseover on the picture box.. sorta like this:

    Picture1.MousePointer = Picture1.MouseIcon

    ... but that gives me an overflow error.


    [Edited by Jordan on 10-02-2000 at 07:35 PM]

  6. #6
    Guest
    Try this:

    Code:
    Private Sub Form_Load()
    Picture1.MouseIcon = "C:\Icons\MyIcon.ico"
    End Sub
    
    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Picture1.MousePointer = vbCustom
    End Sub
    vbCustom = Picture1.MouseIcon

    That should work.

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