c# drawpolygon() как рисовать несколько фигур

как с помощью DrawPolygon рисовать так, чтобы при рисовании новой фигуры не пропадала старая?

введите сюда описание изображения Рисую первую фигуру

введите сюда описание изображения Рисую вторую, пропадает первая

введите сюда описание изображения

using (var PenP = new Pen(Color.Black, 0.1f))
        using (var brush = new SolidBrush(Color.White))
        {


            if (Class1.CheckPoint() != null)
            {
                
                
                int i = Class1.CheckPoint()[0];
                int j = Class1.CheckPoint()[1];
                int cp = Class1.CheckPoint()[2];

                if(cp == 1){
                    PenP.Color = Color.Red;
                    brush.Color = Color.IndianRed;
                    Point[] a = { new Point(i, j), new Point(i + 1, j), new Point(i + 1, j + 1), new Point(i, j + 1) };
                    e.Graphics.FillPolygon(brush, a);
                    e.Graphics.DrawPolygon(PenP, a);
                

                }
                if (cp == 2)
                {
                    PenP.Color = Color.Blue;
                    brush.Color = Color.RoyalBlue;
                    Point[] a = { new Point(i, j), new Point(i + 1, j), new Point(i + 1, j + 1), new Point(i, j + 1) };
                    e.Graphics.FillPolygon(brush, a);
                    e.Graphics.DrawPolygon(PenP, a);                        
                }
            }
        }

Ответы (0 шт):