Diagram shapes are added to the Items property of the page. To get notified when a shape has been added or removed from a page, subscribe to the ChildInserted and ChildRemoved events of the page's Items collection as shown below:
Shape Inserted and Removed Events |
Copy Code
|
---|---|
NPage page = drawingView.ActivePage; page.Items.ChildInserted += OnPageChildInserted; page.Items.ChildRemoved += OnPageChildRemoved; private void OnPageChildInserted(NInsertChildEventArgs arg) { NShape shape = arg.InsertedNode as NShape; if (shape != null) { NMessageBox.Show("Shape Name: " + shape.Name, "Shape Inserted"); } } private void OnPageChildRemoved(NRemoveChildEventArgs arg) { NShape shape = arg.RemovedNode as NShape; if (shape != null) { NMessageBox.Show("Shape Name: " + shape.Name, "Shape Removed"); } } |