miltonjbradley
miltonjbradley

Reputation: 601

Clearing drawn objects in C# WPF

I have used this code to draw a set of ellipses in C# but I do not know how to erase them. Any help would be greatly appreciated. Here is the code I use to draw:

private void drawEllipseAnimation(double x, double y)
    {

        Ellipse e = new Ellipse();
        e.Fill = Brushes.Yellow;
        e.Stroke = Brushes.Black;
        e.Height = 10;
        e.Width = 10;
        e.Opacity = 1;
        MainCanvas.Children.Add(e);
        Canvas.SetLeft(e, x);
        Canvas.SetTop(e, y);
    }

Upvotes: 0

Views: 4552

Answers (1)

brunnerh
brunnerh

Reputation: 185445

MainCanvas.Children.Clear()?

Upvotes: 3

Related Questions