当前位置: 代码迷 >> ASP.NET >> winform中把图片保存到本地文件夹的代码如何写
  详细解决方案

winform中把图片保存到本地文件夹的代码如何写

热度:9207   发布时间:2013-02-25 00:00:00.0
winform中把图片保存到本地文件夹的代码怎么写?
我在做个截屏的winform程序,就是我怎么把截取后的图片保存到本地?就是想我点击保存按钮,然后弹出个选择路径的框,然后把路径选好,点保存就存到本地了,这个保存button下面的代码是怎么写?我的截图代码给大家贴出来
private void cropBtn_Click(object sender, EventArgs e)
  {
  try
  {
  int topx, topy, bottomx, bottomy;

  topx = Int32.Parse(this.topLeftXTextBox.Text);
  topy = Int32.Parse(this.topLeftYTextBox.Text);
  bottomx = Int32.Parse(this.bottomRightXTextBox.Text);
  bottomy = Int32.Parse(this.bottomRightYTextBox.Text);

  this.modifiedBitmap = BitmapManipulator.CropBitmap(this.modifiedBitmap,
  new Rectangle(topx, topy,
  bottomx - topx, bottomy - topy));
  Redraw();
  }
  catch (Exception exp)
  {
  MessageBox.Show(String.Format("Error performing this operation.\nException: {0}\nText:{1}",
  exp.GetType().Name,
  exp.Message),
  "Error");
  }
  }

------解决方案--------------------------------------------------------

C# code
SaveFileDialog odg = new saveFileDialog();odg.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites).ToString();saveFileDialog1.Filter="(*.jpg)|(*.gif)|(*.*)";
  相关解决方案