Hi Eddi,
some background information about this: If you drag some text from a text
editor (e. g. MS Word) into Visio, then Visio creates a new text shape with
this text inside. After this, Visio throws a ShapeAdded event.
So, what you have to do is:
- give each draggable treenode a unique identifier
- create a Visio stencil with one master shape for each type of your
draggable elements
Now you application has to
- add the identifier of the dragged node into the Windows clipboard when
starting a drag operation
- catch Visio's ShapeAdded event
- read the coordinates of the new text shape as well as the shape's text
(which is the identifier of the dragged element)
- delete the text shape
- analyse the identifier in order to determine which element in our
application has been dragged
- determine the master shape that is to represent the dragged element
- create a new shape based on the previously identified master shape. Create
this shape at the same coordinates at which Visio has previously created the
text shape.
- Fill the new shape with some text, e.g. with the name of the dragged
element.
So, this is how we did this, and it works very well.
Hope this information helps.
Best regards,
Markus
eddie said:
Hi,
I have develop a TreeView using VC++(API), and i wanna drag and drop
shapes from the tree like in Visio UML. I would like to know how to drag and
drop a shape to the cursor position in the same way the UML Visio Template.