How do I get screen coordinates?

B

BMG Support

I have the active page and the pinX and pinY
positions of a shape on that page.

How do I convert these to screen coordinates?


(FYI - I want to place a std window near to the
shape in question)
 
C

Chris Roth

I think Window.GetViewRect and Window.GetWindowRect will help you get close.

GetViewRect: Gets the size and position of the client area of a
window. (pixels)
GetWindowRect : Returns the page coordinates of a window's borders.

Something like this:

Sub x()

Dim l As Long, t As Long, w As Long, h As Long

'Application window:
Visio.Application.Window.GetWindowRect l, t, w, h
Debug.Print "Visio Application window: " & l, t, w, h

'Drawing window:
Visio.ActiveWindow.GetWindowRect l, t, w, h
Debug.Print "Current Drawing window: " & l, t, w, h

'More - find out the PinX, PinY of the shape

'Compare this to GetWindowRect's left and top.

'Convert the mess from Page units to screen coordinates.

End Sub

--

Hope this helps,

Chris Roth
Visio MVP

(e-mail address removed)

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
 

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

Top