日期:2014-05-18  浏览次数:21224 次

Bitmap.save()方法怎么使用
System.IO.Directory.CreateDirectory("C:\\新建文件夹");
  string wenjian = "C:\\新建文件夹";
  FolderBrowserDialog fbd = new FolderBrowserDialog();
  if (fbd.ShowDialog() != DialogResult.OK)
  {
  return;
  }
  strpath = fbd.SelectedPath;
  strjpg = Directory.GetFiles(strpath, "*.jpg", SearchOption.AllDirectories);
  foreach (string jpg in strjpg)
  {
  System.Drawing.Bitmap objPic, objNewPic;
  objPic = new System.Drawing.Bitmap(jpg);
  objNewPic = new System.Drawing.Bitmap(objPic, Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text));
  objNewPic.Save(wenjian + "" + jpg + "");
  }
  MessageBox.Show("转换成功!");
  }

objNewPic.Save(wenjian + "" + jpg + ""); 提示我格式不正确,我如何把转换后的文件放入到一个新的文件夹中?

------解决方案--------------------
C# code
objNewPic.Save(wenjian+"\\"+Path.GetFileName(jpg));