Results 1 to 2 of 2

Thread: trapping mouse in picture box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    27
    How would i go about trapping the mouse inside the picture box that i am drawing a line in? I have absolutely no idea how to do this. If someone could give me some pointers i would really appreciate this.

  2. #2
    Guest
    Yes, in fact, I'll give you an working example that you can use.

    Code:
    Public Declare Function KeepKursor Lib "user32" _
    Alias "ClipCursor" (lpRect As Any) As Long
    Public Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    
    Sub CursorR(PictureB As PictureBox)
      Dim rrt As Rect
      rrt.Left = PictureB.Left
      rrt.Top = PictureB.Top
      rrt.Right = PictureB.Left + Picture1.Width
      rrt.Bottom = PictureB.Top + Picture1.Height
      KeepKursor(rrt)
    End Sub
    Also, if you want to learn, reserch ClipCursor.

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