can anyone help me out? i need to capture mouseclicks as well as coordinates only within a certain picturebox. the program should not detect any mouse events once the cursor falls outside the picturebox of my application.
thanks in advance:D
Printable View
can anyone help me out? i need to capture mouseclicks as well as coordinates only within a certain picturebox. the program should not detect any mouse events once the cursor falls outside the picturebox of my application.
thanks in advance:D
if your picturebox is called Picture1, you will have the following event for mouse-clicks.
VB Code:
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Your code here End Sub
Notice the parameters to it - "button" to say which mouse button, "shift" I think says the shift/ctrl/alt keys, "x" and "y" you can probably guess...
thanks for your help. i'll try out the code. btw, when it captures the coordinates, will the coordinates correspond to the picturebox only or is the coordinate refer to the mouse position in the monitor screen as a whole? (eg, if i click on the upper left hand corner of the picture box, will it return coordinates 0,0 or otherwise?)
can VB also detect mouseclick using opengl? since i'm using opengl with VB, can i detect mouse clicks and subsequently capture its coordinates in that opengl drawing context?
from putting this code in that sub:
MsgBox X & vbCr & Y
you can see that it is relative to the picturebox only.
no idea about open-gl, sorry!