Group: Forum Members
Last Active: 8 Years Ago
Posts: 28,
Visits: 136
|
Hi,
I would like to add ports to a NComposite but it seems that the method "CreateShapeElements" doesn't work? When I try to use the "HeatExChanger1.Ports.ChildrenCount(null))" it gives 0??
That means that it fails to use the line.startplug.connect and line.endplug.connect methods. What should I do instead?
protected NCompositeShape CreateHeatExchanger(NPointF location, float scale) { NCompositeShape HeatExchanger = new NCompositeShape(); GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.StartFigure(); PointF[] points = new PointF[] { new PointF(175,140), new PointF(175,160), new PointF(150,170), new PointF(200,170), new PointF(175,180), new PointF(175,200), }; graphicsPath.AddLines(points); NPointF[] points2 = new NPointF[] { new NPointF(145,140), new NPointF(205,140), new NPointF(205,200), new NPointF(145,200), }; NPolygonPath exterior = new NPolygonPath(points2); HeatExchanger.Primitives.AddChild(new NCustomPath(graphicsPath, PathType.OpenFigure)); HeatExchanger.Primitives.AddChild(exterior); HeatExchanger.Style.FillStyle = new NColorFillStyle(Color.Empty); HeatExchanger.UpdateModelBounds(); HeatExchanger.CreateShapeElements(ShapeElementsMask.Ports); HeatExchanger.Location = location; HeatExchanger.Width = HeatExchanger.Width * scale; HeatExchanger.Height = HeatExchanger.Height * scale;
return HeatExchanger; }
|