Hi,
Thanks for the update.
1) Event to subscribe when connecting shapes using connectorThe event EventSink.ConnectionChanged will be raised when trying to connect the diagram shapes using line connector. The following code snippet illustrates this.
[C#]
this.Diagram1.Model.EventSink.ConnectionsChanged += new CollectionExEventHandler(EventSink_ConnectionsChanged);
2) Creating difficult electric shapes.You can use Symbol designer utility to create custom shapes using the Electric Shapes palette which will be the easier one. Please refer the following Online tutorial link on using SymbolDesignerUtility for creating custom shapes.
http://www2.syncfusion.com/ug_62/diagram/SymbolDesigner.htmlIf you want to create custom shapes programmatically using Electric Shapes palette, then you need to get the shape from the palatte file and add it to the diagram. For implementation details, please refer the sample that shipped with Essential Studo in the below location that demonstrates on adding shapes from the palette file to the diagram.
..\My Documents\Syncfusion\EssentialStudio\ 6.2.0.40\Windows\Diagram.Windows\Samples\2.0\Designing Symbols\PaletteLoad
3) Using diagram objects in another diagram.Essential diagram allow you to save the diagram in .EDD format and you can use that edd file to display it in another diagram. You can also save the diagram as an image using ExportDiagramAsImage property of diagram.
4) Restricting line connector to connect to particular diagram shape.You can restrict the lineconnector to connect to particular diagram shape using ToNode property of LineConnector. The following code snippet will allow the connector to connect to all diagram shapes except Rectangle3.
[C#]
void EventSink_ConnectionsChanged(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Insert)
{
if (evtArgs.Element is HeadEndPoint)
{
HeadEndPoint headpt = evtArgs.Element as HeadEndPoint;
if (headpt.Container is LineConnector)
{
LineConnector line = headpt.Container as LineConnector;
toNode = line.ToNode as Node;
if (toNode.Name == "Rectangle3")
{
MessageBox.Show("Connection not allowed for Rectangel3");
this.myDiagram1.Model.RemoveChild(line);
}
}
}
else if (evtArgs.Element is TailEndPoint)
{
TailEndPoint tailpt = evtArgs.Element as TailEndPoint;
if (tailpt.Container is LineConnector)
{
LineConnector line = tailpt.Container as LineConnector;
}
}
}
}
Creating ungrouped objects.If you want to ungroup the grouped objects then you can use diagram1.Controller.UnGroup() method.
Sample referencePlease refer the following sample that demonstartes on restricting connection for particular shape , saving the diagram as an image and loading new diagram.
http://websamples.syncfusion.com/samples/Diagram.Windows/F73652/Connection/main.htmPlease let me know if this helps you.
Regards,
Jaya