internal void OnPaint(Graphics graphics, Rectangle rect, Matrix mtx) { ApplyMatrix(mtx); OnDraw(graphics, mtx); if (Children == null) { return; } //foreach (GraphItem gi in Children) { // var state = graphics.Save(); // gi.OnPaint(graphics, rect, mtx); // graphics.Restore(state); //} for (int i = Children.Count - 1; i > -1; --i) { if (ToBeDeleteChildren.Count > 0) { if (ToBeDeleteChildren.Contains(Children[i])) { Children.RemoveAt(i); } } else { var state = graphics.Save(); (Children[i] as GraphItem).OnPaint(graphics, rect, mtx); graphics.Restore(state); } } }
public void DeleteChildrenOnPaint(GraphItem child) { lock (ToBeDeleteChildren) { ToBeDeleteChildren.Add(child); } }