TreeView

E

eddie

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
I appreciate any help
Thank u.
 
M

Markus Breugst

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.
 

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