Profile Picture

Can't add a NRectange to NComposite

Posted By Hans Henrik Friis Pedersen... 10 Years Ago
Author
Message
Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi, composite shape primitives should be paths, not other shapes. That is why your code is not working. You should use NRectanglePath instead of NRectangleShape. Check out the Composite Shapes documentation topic for more information.

Best Regards,
Nevron Support Team



Hans Henrik Friis Pedersen...
Problem Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 28, Visits: 136
Hi,

1) Why can't I add a rectange to NComposite?
2) How do I then add a rectange to a Composite? I have to make the rectange using a Polygon?


NCompositeShape shape = new NCompositeShape();
NRectangleShape rectx = new NRectangleShape(new NRectangleF(150, 150, 50, 50));

NShape rect2 = factory.CreateShape(BasicShapes.Rectangle);
rect2.Bounds = new NRectangleF(250, 200, 75, 75);
rect2.CreateShapeElements(ShapeElementsMask.Ports);
rect2.Style.FillStyle = new NColorFillStyle(Color.Empty);

NPolygonPath cup = new NPolygonPath(new NPointF[]{ new NPointF(45, 268),
  new NPointF(63, 331),
  new NPointF(121, 331),
  new NPointF(140, 268)});

//document1.ActiveLayer.AddChild(rect2);
shape.Primitives.AddChild(cup);
shape.Primitives.AddChild(rectx); // an exception is raised here
shape.Primitives.AddChild(rect2);// an exception is raised here





Similar Topics


Reading This Topic