//Add a custom connector to symbbol palette...
private void CreatePaletteConnector(string id)
{
ExampleConnector diagramConnector = new ExampleConnector()
{
Id = id,
};
ConnectorList.Add(diagramConnector);
}
//Activate tool to draw a custom connector...
private void Draw(MouseEventArgs args)
{
drawingObject = new ExampleConnector();
diagram.Tool = DiagramTools.ContinuousDraw;
}
public class ExampleConnector : DiagramConnector
{
public ExampleConnector() : base()
{
Type = DiagramSegments.Orthogonal;
SourcePoint = new ConnectorSourcePoint() { X = 0, Y = 0 };
TargetPoint = new ConnectorTargetPoint() { X = 100, Y = 100 };
Style = new ConnectorShapeStyle()
{
StrokeColor = "#FF0000",
StrokeWidth = 2,
};
TargetDecorator = new ConnectorTargetDecorator() { Shape = DecoratorShapes.None };
Constraints = ConnectorConstraints.Default & ~ConnectorConstraints.Drag;
}
} |