我是这样保存的Bitmap bitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
bitmap = (Bitmap)pictureBox1.Image;                        
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
saveFileDialog1.Title = "Save an Image File";
saveFileDialog1.ShowDialog();
            saveFileDialog1.AddExtension=true;
if(saveFileDialog1.FileName != "")
{
// Saves the Image via a FileStream created by the OpenFile method.
// Saves the Image in the appropriate ImageFormat based upon the
// File type selected in the dialog box.
// NOTE that the FilterIndex property is one-based.
switch(saveFileDialog1.FilterIndex)
{
case 1 : 
try
{
bitmap.Save(saveFileDialog1.FileName, 
System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch(Exception ee)
{
    MessageBox.Show(ee.ToString());
}
break; case 2 : 
this.pictureBox1.Image.Save(saveFileDialog1.FileName, 
System.Drawing.Imaging.ImageFormat.Bmp);
break; case 3 : 
this.pictureBox1.Image.Save(saveFileDialog1.FileName, 
System.Drawing.Imaging.ImageFormat.Gif);
break;

解决方案 »

  1.   

    应该在picturebox的paint事件里画线。而且思路好像反掉了。应该画在bitmap上,然后把这个bitmap设为picturebox的image
      

  2.   

    不好意思...刚才我是对picturebox直接加载图像的..可以保存到文件中...但当在picturebox.paint事件中画时,就不能保存了...因为pictureBox.Image=NULL;
    楼主可以把对picturebox的画图写到一个类中....
    form.cs:有一个调用画图类的函数....这样就可以显示图像了...
    单击button:也调用一次画图函数....然后继续执行LZ所贴的代码就可以了...本来想用this.pictureBox1.Refresh();来调用pictureBox1.Paint()事件的...可是它要等到Button.click()全部执行完成才执行...这个方法行不通..所以就想到上面的那个方法了...呵呵..希望有用...
      

  3.   

    form的onpaint,操作系统才会给你重绘,或者你把画的image给picture的image属性,而不要直接在picture的graphics画
      

  4.   

    在bitmap上怎么画图阿?我不知道怎么画。
      

  5.   

    在帮帮忙好不?在bitmap上怎么画图阿?
      

  6.   

    Bitmap bitmap=new Bitmap(100,100);
    Graphics g=Graphics.FromImage((Image)bitmap);
    g.FillRectangle(Brushes.Red,0,0,100,100);
    this.pictureBox1.Image=(Image)bitmap;
      

  7.   

    GDI+的重绘问题啊.画在bitmap上面也可以贴在picturebox上面