Problem of adding a NPointPort to a NCustomShape


Author
Message
Wilhelm Vortisch
Wilhelm Vortisch
Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)
Group: Forum Members
Posts: 14, Visits: 1
Hi folks,

I have a problem in adding a NPointPort to a NCustomShape. The NCustomShape is in a library browser.
Always if I drop (a copy of) the master in the drawing document, the port is on position 0,0 of the drawing document and not in the shape bounds.
In the following code I create the custom shape with one port (to the fourth point):

private NCompositeShape createComplexCompositeShape()
{
NCompositeShape shape = new NCompositeShape()

NPolygonPath newElement = new NPolygonPath(new NPointF[]
{
new NPointF(0, 10),
new NPointF(0, 90),
new NPointF(50, 90),
new NPointF(50, 100),
new NPointF(50,90),
new NPointF(100, 90),
new NPointF(100, 10),
new NPointF(50, 10),
new NPointF(50, 0),
new NPointF(50,10),
});
shape.Primitives.AddChild(newElement);
shape.UpdateModelBounds();

shape.Style.FillStyle = new NColorFillStyle(Color.AliceBlue);
shape.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(0, 0, 0x88));

// create the shape ports
shape.CreateShapeElements(ShapeElementsMask.Ports);

NPointPort port1 = new NPointPort(shape.UniqueId, PointIndexMode.Custom, 4);
shape.Ports.AddChild(port1);

return shape;
}


Any tips?

Kind Regards

Wilhelm
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search