private void 保存SToolStripButton_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif"; string localFilePath = saveFileDialog1.FileName.ToString();//获取路径 saveFileDialog1.ShowDialog(); if (saveFileDialog1.ShowDialog() == DialogResult.OK) { MapExport export = new MapExport(this.mapControl1.Map.Clone() as Map);// export.ExportSize = new ExportSize(this.mapControl1.Map.Size.Width, // 尺寸 当前屏幕 this.mapControl1.Map.Size.Height); export.Format = ExportFormat.Gif;// 格式 gif export.Export(@"localFilePath\ExportImage.gif"); } } 如果不用saveFileDialog,直接用下面的程序是能成功的 MapExport export = new MapExport(this.mapControl1.Map.Clone() as Map); export.ExportSize = new ExportSize(this.mapControl1.Map.Size.Width, this.mapControl1.Map.Size.Height); export.Format = ExportFormat.Gif; export.Export(@"D\ExportImage.gif"); 没有多少分,还请各位高手帮帮忙
export.Export(@"localFilePath\ExportImage.gif");改为export.Export(saveFileDialog1.FileName)
string localFilePath = saveFileDialog1.FileName.ToString()放在
if (saveFileDialog1.ShowDialog() == DialogResult.OK) { 里面
export.Export(localFilePath+"\ExportImage.gif");