Hi,
I am trying to create a new shape and add the shape into a document. However I am getting an error "An item with the same key has already been added." when I try to add the same shape to a document. This happens even if I assign a new unique ID to the shape. I am creating the shape from an Nmodel object obtained from the stencil library.
The error is on this line of code ((NLayer)document.Layers.Children(null)[layerID]).AddChild((NShape)newShape);
What am I doing wrong here? Thanks.
Here's my code
private
{
listShapes.Items.Clear();
listConnects.Items.Clear();
nlayer =
nlayer.Name = layer.Name.Value;
nlayer.Id = layer.IX;
document.Layers.AddChild(nlayer);
listLayers.Items.Add(layer.IX.ToString() +
}
document.ActiveLayerUniqueId = ((
listShapes.Items.Add(shape.ID.ToString() +
AddShapeToDocument(shapeLabel,
(
layers++;
listConnects.Items.Add(
newShape.Tag =
newShape.Bounds =
newShape.UniqueId =
(newShape.Tag
((