拖动边框图像延迟显示导致图像不连续问题

图片说明
如图,我是用winform进行编写的,写了一个用户控件,在用户控件里面写了如下的代码:
public void DrawYLine(Graphics g, Point start, Point end)
{
SolidBrush brush = new SolidBrush(Color.Black);
Pen pen1 = new Pen(brush, 3);
g.DrawLine(pen1, start, end);
for (int i = 0; i <= 10; i++)
{

        }
    }

    private void panel1_Paint(object sender, PaintEventArgs e)
    {
        Point StartPoint = new Point(0, 0);
        Point EndYPoint = new Point(this.Width, this.Height);
        Graphics g = e.Graphics;

        SolidBrush brush1 = new SolidBrush(Color.Black);
        Pen p1 = new Pen(brush1);

        //Point pt1 = new Point(this.Width / 2, this.Height / 2);
        //Size sz1 = new Size(50, 50);
        //Rectangle rec = new Rectangle(pt1, sz1);

        DrawYLine(g, StartPoint, EndYPoint);
    }

但是在拖动屏幕的时候为什么会出现如图不连贯的锯齿状图形,求大侠指教

拖动屏幕,是拖动窗体吗?
如果是,则是需要处理 OnPaint 来重画的,否则出现不显示、或者显示异常是常见的现象。