I want to delete all chart objects using a button but I can't delete the lines, text ... using the RemoveDrawObjects or RemoveDrawObject methods. My Button is working and prints all chart objects into the output window but nothing is deleted, why?
Thanks
Mario
private void ButtonClick(object s, EventArgs e) { try{ foreach (IDrawObject draw in ChartControl.ChartObjects) { if(draw.DrawType == DrawType.Line ||draw.DrawType == DrawType.Ray || draw.DrawType == DrawType.HorizontalLine ||draw.DrawType == DrawType.Ellipse || draw.DrawType == DrawType.Rectangle ){ RemoveDrawObject(draw.Tag); Print(draw.Tag); } } } catch(Exception ex){ Print("error: " +ex.ToString()); } finally{ ChartControl.Refresh(); } }
Comment