Results 1 to 2 of 2

Thread: Help: Picturebox Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    1
    I have a picturebox control with a customized scale. I want to determine the coordinates of the point where i click the mouse within this picture box. How can I do this?

    Abhishek.

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    I'm not sure which value you are trying to convert but nevertheless the ScaleX and ScaleY functions are probably your best bet.

    Code:
    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Picture1.Cls
        Picture1.Print "USER COORD X = " & X
        Picture1.Print "USER COORD Y = " & Y
        Picture1.Print "TWIPS X = " & Picture1.ScaleX(X, vbUser, vbTwips)
        Picture1.Print "TWIPS Y = " & Picture1.ScaleY(Y, vbUser, vbTwips)
        Picture1.Print "PIXELS X = " & Picture1.ScaleX(X, vbUser, vbPixels)
        Picture1.Print "PIXELS Y = " & Picture1.ScaleY(Y, vbUser, vbPixels)
    End Sub
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

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