Problem with ports of shapes inserted from LibraryBrowser
Print Topic | Close Window

By Hans Henrik Friis Pedersen - 7 Years Ago

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);

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

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



        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;