Profile Picture

Use a Factory Shape as part of an NCompositeShape

Posted By Mohamed Salti 11 Years Ago
Author
Message
Mohamed Salti
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 4, Visits: 1
Thanks! I had some dll version issues on my local machine, once fixed my original code worked.

Thanks again!

Nevron Support
Posted 11 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: Last Week
Posts: 3,054, Visits: 4,009

Hi,

We have just tested a piece code that mimics your scenario and it works fine. Here it is, try it out:

CustomCompositeShape compositeShape = new CustomCompositeShape();

document.ActiveLayer.AddChild(compositeShape);

compositeShape.Initialize();

compositeShape.Location = new NPointF(100, 100);

 

...

 

[Serializable]

public class CustomCompositeShape : NCompositeShape

{

        public void Initialize()

        {

               NBasicShapesFactory factory = new NBasicShapesFactory();

               factory.DefaultSize = new NSizeF(100, 100);

 

               NShape shape1 = factory.CreateShape(BasicShapes.Rectangle);

               shape1.Compose(this);

 

               NShape shape2 = factory.CreateShape(BasicShapes.Circle);

               shape2.Location = new NPointF(100, -50);

               shape2.Compose(this);

 

               UpdateModelBounds();

        }

}



Best Regards,
Nevron Support Team



Mohamed Salti
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 4, Visits: 1
Hello,

I would like to use shapes provided by your shape factory as a part of my NCompositeShape.

According to the documentation I should be able to use the Compose() method provided by the NShape object to do this.

The following code throws the exception: 'The specified node cannot be inserted at index: 0'

//CODE START

NFlowChartingShapesFactory f = new NFlowChartingShapesFactory(NGraphicsUnit.Pixel, 96);
f.DefaultSize = new NSizeF(80, 60);

var zz = f.CreateShape(FlowChartingShapes.Document);
zz.Compose(this); //exception thrown on this line. FYI 'this' inherits from NCompositeShape

//CODE END

Any help with this would be greatly appreciated.

Thanks!



Similar Topics


Reading This Topic