Problem with ports of shapes inserted from LibraryBrowser


https://www.nevron.com/Forum/Topic8933.aspx
Print Topic | Close Window

By Hans Henrik Friis Pedersen - 7 Years Ago
Hi,

I'm using the attached class to make a shape.

When directly inserted the ports are present and everything works fine.

However, If I use the following code to insert the shape into a library and then try to insert the shape into a nDrawingDocument using "drag and drop", the ports are no longer present? What have I done wrong? 


        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            CondensorShape Kondensator = CreateCondensor(new NPointF(120, 20), 1.0f, 0.0f);
            nDrawingDocument1.ActiveLayer.AddChild(Kondensator);

            // create a new library
            NLibraryDocument library = new NLibraryDocument();
            library.Info.Title = "My first library";


             library.AddChild(new NMaster(Kondensator, NGraphicsUnit.Pixel, "Kondensator", "My Kondensator"));

            nLibraryBrowser1.OpenLibraryGroup(library);

        }

        protected CondensorShape CreateCondensor(NPointF location, float scale, float rotation)
        {
            CondensorShape Condensor = new CondensorShape();
            NStyle.SetFillStyle(Condensor, new NColorFillStyle(Color.Empty));

            Condensor.Location = location;
            Condensor.Width = Condensor.Width * scale;
            Condensor.Height = Condensor.Height * scale;
            Condensor.Rotate(CoordinateSystem.Scene, rotation, Condensor.Location);

            return Condensor;
        }