N
Niklas Deutschmann
Hi,
I have a tree view with my model elements as an anchor window. When a model
element from this tree view is dragged on the page, a new shape should be
created that has some model-specific information attached (e.g. the ID of the
model element).
The code on the drag source side is like this:
private void modelStructureTree_ItemDrag(object sender, ItemDragEventArgs
e){
TreeNode draggedNode = e.Item as TreeNode;
object modelObject = draggedNode.Tag;
Master master = getMasterForObjectType(modelObject.GetType());
Shape shape = master.Shapes[1];
DoDragDrop(shape, DragDropEffects.Move);
}
I cannot attach the model element ID to "shape" because "shape" is the
master shape, and not a shape that has been created from the master (this
happens when the shape is dropped, I guess).
So, I
1.) Either need to instantiate a shape on the drag source side. Can I create
a shape "in memory", without dropping it on a page, and pass it to
DoDragDrop()?
2.) Or access the dropped object on the drop target side (in the event
handler for visEvtCodeMouseMove). But I don't see any property for the
Drag&Drop data transfer object in Visio's MouseEvent object. Moreover, when I
pass a custom object (and not a shape) to DoDragDrop() on the drag source
side, dropping the object will be refused by Visio and no visEvtCodeMouseMove
event that represents a drop will be generated at all.
So, how can I create shapes which reference their model elements by
drag&drop from an anchor window?
Regards,
Niklas
I have a tree view with my model elements as an anchor window. When a model
element from this tree view is dragged on the page, a new shape should be
created that has some model-specific information attached (e.g. the ID of the
model element).
The code on the drag source side is like this:
private void modelStructureTree_ItemDrag(object sender, ItemDragEventArgs
e){
TreeNode draggedNode = e.Item as TreeNode;
object modelObject = draggedNode.Tag;
Master master = getMasterForObjectType(modelObject.GetType());
Shape shape = master.Shapes[1];
DoDragDrop(shape, DragDropEffects.Move);
}
I cannot attach the model element ID to "shape" because "shape" is the
master shape, and not a shape that has been created from the master (this
happens when the shape is dropped, I guess).
So, I
1.) Either need to instantiate a shape on the drag source side. Can I create
a shape "in memory", without dropping it on a page, and pass it to
DoDragDrop()?
2.) Or access the dropped object on the drop target side (in the event
handler for visEvtCodeMouseMove). But I don't see any property for the
Drag&Drop data transfer object in Visio's MouseEvent object. Moreover, when I
pass a custom object (and not a shape) to DoDragDrop() on the drag source
side, dropping the object will be refused by Visio and no visEvtCodeMouseMove
event that represents a drop will be generated at all.
So, how can I create shapes which reference their model elements by
drag&drop from an anchor window?
Regards,
Niklas