我向把图形框画的 图形保存起来,为什么不行呢?请高手帮忙!!!!!   private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen p1 = new Pen(Color.Red);      
            g2.FillRectangle(b1, 100, 100, 100, 100);           // -----------------创建图象---------------
            Bitmap pic = new Bitmap(500, 500, g2);
            pic.Save("c:\\me.bmp", ImageFormat.Bmp);
          
        }

解决方案 »

  1.   

    不知道你这段代码干什么的,而且你这里有一严重的问题
    保存的操作不应该放到Paint里面
      

  2.   


    其实我是在图片框中画了一的图形(pictureBox1),我想把当她绘制的时候 也可以保存到文件中private void pictureBox1_Paint(object sender, PaintEventArgs e)
            {
                Graphics g = e.Graphicse;
                Pen p1 = new Pen(Color.Red);      
                g.FillRectangle(b1, 100, 100, 100, 100);           // -----------------创建图象---------------
                Bitmap pic = new Bitmap(500, 500, g);
                pic.Save("c:\\me.bmp", ImageFormat.Bmp);
              
            }
      

  3.   

    private void save
    {
    Bitmap pic  = new Bitmap(500, 500);
    g = Graphics.FromImage(pic  );
    Pen p1 = new Pen(Color.Red);  
    g.FillRectangle(p1, 100, 100, 100, 100);
    pic.Save("c:\\me.bmp", ImageFormat.Bmp);}
    看看这样的行不行,没装vs,帮不了什么
      

  4.   

    private void pictureBox1_Paint(object sender, PaintEventArgs e)
            {
                Graphics g = e.Graphicse;
                Pen p1 = new Pen(Color.Red);      
                g.FillRectangle(p1, 100, 100, 100, 100);           // -----------------创建图象---------------
                Bitmap pic = new Bitmap(500, 500, g);
                pic.Save("c:\\me.bmp", ImageFormat.Bmp);
              
            }//代码没有错误,但是看不见我画的图形