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.
Printable View
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.
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