Nevron Forum

Creating a new Tool for a custom Shape.

https://www.nevron.com/Forum/Topic4516.aspx

By Steve Warner - Thursday, November 18, 2010

I currently am creating custom shapes on the fly that are being placed onto my NDrawingDocument. My shapes are similar to the following:

public class MyShape : NGroup
{
public MyShape()
{
//Put some shapes into the group
}
}

I can programmatically add these to the document and then manipulate them using the Pointer tool, etc. without any issues. My problem is I need to place them on a toolbar so that a user can draw a brand new one on the Document. How do I go about doing that? Any code examples would be great.
By Volvick Derose 1 - Tuesday, November 23, 2010

To add a shape to the toolbar, you can handle the onclick event and do something like that inside the onlclick event

I assume you want to add the shape to the document when a user clicks on that button

MyClass myClass = new MyClass();

NGroup myGroup //do something here from your class

nDrawingDocument1.ActiveLayer.AddChild(myGroup);//that will add the shape to the drawing document
//when user clicks on the button on the toolbar