现在程序可以在pictureBox上随意绘图,但保存的时候picturebox.image里为什么是null??

解决方案 »

  1.   

    最后将画完的image保存进picturebox.image。这步不是自动实现的,需要写代码
      

  2.   

    具体怎么写,我现在用的鼠标事件绘的图,但保存时候pictureBox1里空的
    private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
            {
                this.CanMove = true;
                startpt.X = e.X;
                startpt.Y = e.Y;
            }        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
            {
                if (this.CanMove == true)
                {
                    Graphics g = pictureBox1.CreateGraphics();
                    endpt.X = e.X;
                    endpt.Y = e.Y;
                    g.DrawLine(new Pen(Color.Red, 1), startpt, endpt);
                    startpt = endpt;
                }
            }        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
            {
                Graphics g = this.CreateGraphics();
                g.DrawLine(new Pen(Color.Red, 1), this.startpt, new Point(e.X, e.Y));
                this.CanMove = false;
            }