how do i use mouse co-ordinates 
Author Message
 how do i use mouse co-ordinates

  It has been suggested to me that I use mouse co-ordinates to activate a
click event on a picture How should I approach this.
The idea is I have one picture and would like to run a different macro
depending where is clicked.

Thanks
Kevin



Fri, 20 Jun 2003 23:21:23 GMT  
 how do i use mouse co-ordinates
I think you could use the mousedown event and then use the X and Y
properties to determine where the mouse is. Then use a few "if..thens" to
create hotspots.

Disco



Sat, 21 Jun 2003 00:24:37 GMT  
 how do i use mouse co-ordinates
The PictureBox control has a MouseDown and MouseUp event, and included in
the parameter list for these events are the X and Y coordinates of where the
user down clicks and up clicks the mouse.  If your regions can be described
mathematically, then you can have the click do anything you like depending
on where the user clicks.  For example, the following code performs 2
different actions depending on whether the user clicks the right or left
half of the PictureBox....

Private Sub picBox_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
    If X > picBox.Width / 2 Then
        MsgBox "The user clicked the right half"
        'Call Sub RightHalfClick
    Else
        MsgBox "The user clicked the left half"
        'Call Sub RightHalfClick
    End If
End Sub

This code assumes the ScaleMode of the Form and PictureBox are set to the
same value.



Sat, 21 Jun 2003 00:43:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Forcing mouse pointer to move to a co-ordinate

2. Finding mouse co-ordinates

3. mouse co-ordinates...

4. Mouse Co-ordinates

5. passing mouse click co-ordinates to class function

6. find value using screen co-ordinates

7. Line Co-ordinates

8. EXCEL 2000 : Selection Co-ordinates

9. Obtaining x,y co-ordinates of a Dropped Object

10. MDI co-ordinates, docking form and more

11. Co-ordinates

12. print box with co ordinate control

 

 
Powered by phpBB® Forum Software