Drawing Control - Drag Drop

H

HomerJ

I am using the Visio Drawing Control and want to drag & drop an external
object at the specific coordinate where user 'drops' object.

How can I convert the Drawing Controls Drag_Drop event X/Y to drawing coords
so I can create the required shape at that point?
 
C

Chris Roth [ Visio MVP ]

The Visio drawing control will give you mouse over/up/click coordinates, if
you want. You can convert from window to page coordinates using GetViewRect
and GetWindowRect functions.

Another method might be get the shape object for whatever your users are
dragging. Your users are dragging something onto the Visio page. Is Visio
receiving some "thing" (text or foreign object) that you have to delete
after the drag-and-drop? If so, you can find the location of that thing via
the ShapeAdded event. You'll get a shape obect, for which you can query
shape.Cells("PinX").ResultIU to get the X location of the shape on the page.
Use "PinY" to get the Y location of the shape on the page.

Drop your "replacement object" at this x-y location.


--

Hope this helps,

Chris Roth
Visio MVP
 
H

HomerJ

Thanks for th comments Chris.

The user will drag an item from a listview (think Catalog item) and drop it
on the drawing at a specific point. Based on the itemID my app will add the
appropriate shape at that X.Y coord. User will not be dragging a viso shape.

I'd appreciate a reference to any sample code that shows use of GetViewRect
and GetWindowRect functions.

Ideally the next version of visio should provide a method to convert
DrawingControl mouse event points to Drawing Points or provide an event
directly e.g Drawing_Drag_Drop - fingers crossed!!)
 

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