Profile Picture

Problem with ports of shapes inserted from LibraryBrowser

Posted By Hans Henrik Friis Pedersen... 7 Years Ago

Problem with ports of shapes inserted from LibraryBrowser

Author
Message
Hans Henrik Friis Pedersen...
Question Posted 7 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: 6 Years Ago
Posts: 28, Visits: 136
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;
        }



Attachments
CondensorShape.txt (429 views, 3.00 KB)


Similar Topics


Reading This Topic