Results 1 to 4 of 4

Thread: mouse click

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    321

    Exclamation mouse click

    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

  2. #2
    Si_the_geek
    Guest
    if your picturebox is called Picture1, you will have the following event for mouse-clicks.
    VB Code:
    1. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  
    3.   'Your code here
    4.  
    5. 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...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    321

    thanks

    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?

  4. #4
    Si_the_geek
    Guest
    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!

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