i can't remove a shape

Aug 18, 2013 at 5:07 PM
i'm using a Diagram that i named "model1" in which i add some shapes
model1.Model.Shapes.Add("sh1",shape);
i tried to remove the shape by the way
model1.Model.Shapes.Remove("sh1");
but actually this doesn't take a visual effect on the Diagram
it's not removed from the stage
please can any body give a hand ?
Developer
Aug 19, 2013 at 7:12 AM
Hi

Just use diagram1.Delete() after selecting your element ;) how ever if you want to the use model1.Model.Shapes.Remove("sh1"); you should call refresh method of diagram and controller and lab lab lab :P
Aug 19, 2013 at 9:05 AM
Edited Aug 19, 2013 at 9:06 AM
Thank you for replying,

I can't find the Delete method, diagram1.Delete() doesn't exist of course in my code it would be model1.Delete() but it doesn't exist
Of course i tried to refresh the controller's diagram and the diagram but the view still unchanged :/

i tried also to show the shapes's numbers before and after deleting one shape
int NbrShapes = diagram1.Model.Shapes.Count;
MessageBox.Show("number of shapes =" +NbrShapes );
diagram1.Model.Lines.Remove("shape");
NbrShapes = diagram1.Model.Shapes.Count;
MessageBox.Show("number of shapes =" +NbrShapes );
it's working well ; the number of shapes is reduced after deleting but visually the shape is not deleted from the diagram :/

Thank you for your help ^^
Cheers
Developer
Oct 14, 2015 at 8:15 AM
Call remove and then refresh
diagram1.Model.Shapes.Remove("sh1");
diagram1.Controller.Refresh();