Drawing graphics in a worksheet - returning the mouse position.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using functions like

With canvas.Shapes.AddLine(x1, y1, x2, y2).Lin
.Weight = 1.
.ForeColor.RGB = RGB(R, G, B
End Wit

to do elementary graphics in a worksheet. I would like to be able to found out the mouse position at particular points I click on, but cannot find appropriate functions to do this. Does anyone know how?
 
You may wish that you had never asked. So serves you right (grin). Thi
is the bare bones. You need to get into the strange realm of API calls
Do a web search on API and mouse. There is all sorts of informatio
around. I do not have anything more meaningful to your requirements.

'------------------------------------
'- to get mouse position
Public Type POINTAPI
x As Long
y As Long
End Type
Public Declare Function GetCursorPos Lib "User32" (lpPoint As POINTAPI
As Long
Public CoOrd As POINTAPI
'------------------------------
Sub mouse()
xpos = CoOrd.x
GetCursorPos CoOrd
MsgBox ("Across : " & CoOrd.x & vbCr _
& "Down : " & CoOrd.y)
End Sub
'--------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top