如何在pictureBox下画画

怎么在pictureBox上画画C# codeprivate void Form1_Load(object sender, EventArgs e){Graphics g pictu

怎么在pictureBox上画画

C# code
        private void Form1_Load(object sender, EventArgs e)        {            Graphics g = pictureBox1.CreateGraphics();            g.DrawLine(new Pen(Color.White, 10), 0, 0, 111, 111);        }

C# code
        private void Form1_Paint(object sender, PaintEventArgs e)        {            Graphics g = pictureBox1.CreateGraphics();            g.DrawLine(new Pen(Color.White, 10), 0, 0, 111, 111);        }

试了都不行那

[解决办法]
不要用CreateGraphics,而是在PictureBox的Paint事件内直接画
C# code
private void pictureBox1_Paint(object sender, PaintEventArgs e)        {            e.Graphics.DrawLine(new Pen(Color.White, 10), 0, 0, 111, 111);        }