This project has moved and is read-only. For the latest updates, please go here.

ShapesInserted

Apr 3, 2013 at 5:26 PM
Hello Mr. Kurt
I made some changes and I can finally put on the diagram any equipment that previously were loaded into templates with the connection points necessary for each image. Finally works fine in VB.Net. Now I need more help: when I place one equipment in the diagram from the template, I need to load immediately some label and them attached to central point of the custom shape, which, programmatically, I can do in the Event Private Sub display_ShapesSelected, but must I do several exceptions. I think this would work better and more easily using the Event Private Sub display_ShapesInserted, but does not work because I can not identify the equipment that is inserted from the template (CustomShapes), for connection to label.

Thanks
Apr 4, 2013 at 8:05 AM
I assume that you have different templates and they all have different names.
So when you try to identify a shape, you could have a look at the template's name:
foreach (Shape s in e.Shapes) {
    if (s.Template == null) continue;
    if (string.compare(s.Template.Name, "MyTemplate1", true) == 0) {
        // Do something...
    } else if (string.compare(s.Template.Name, "MyTemplate2", true) == 0) {
        // Do something else
    } 
    // ...
}