Results 1 to 2 of 2

Thread: bitblt

  1. #1
    Guest

    Question

    this isnt really about bitblt, but, I am making a paint program.
    I want to get the coord of the mouse, INSIDE the picturebox, I already know how to blit the image to it... I just need to know how to get the coord's of the mouse inside the picbox

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    what exactly do you mean?

    you can use getCursorPos and ScreenToClient to get the current mouse position

    Code:
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    
    Private Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
    
    Private Declare Function ScreenToClient Lib "user32" Alias "ScreenToClient" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    
    Private Sub Picture1_Click()
    
    Dim apiMousePos As POINTAPI
    
    'Get the mouse position on the screen
    GetCursorPos apiMousePos
    
    'translate to PBox Coords
    ScreenToClient Picture1.hWnd, apiMousePos
    
    MsgBox apiMousePos.X & "," & apiMousePos.Y
    
    End Sub


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