In this tutorial i will show you that how can we save the current map window image to your hard drive.
private void button1_Click (object sender, EventArgs e)
{
MapInfo.Mapping.MapExport exportObject = new MapInfo.Mapping.MapExport (this.mapControl1.Map.Clone () as MapInfo.Mapping.Map);
exportObject.ExportSize = new MapInfo.Mapping.ExportSize (this.mapControl1.Map.Size.Width, this.mapControl1.Map.Size.Height);
exportObject.Format = MapInfo.Mapping.ExportFormat.Bmp; / / Save to the clipboard
System.Windows.Forms.Clipboard.SetDataObject (exportObject.Export ()); / / Save to your hard drive
exportObject.Export (@ "D: \ Image.bmp");
MessageBox.Show ("Save successful!");
}
private void button1_Click (object sender, EventArgs e)
{
MapInfo.Mapping.MapExport exportObject = new MapInfo.Mapping.MapExport (this.mapControl1.Map.Clone () as MapInfo.Mapping.Map);
exportObject.ExportSize = new MapInfo.Mapping.ExportSize (this.mapControl1.Map.Size.Width, this.mapControl1.Map.Size.Height);
exportObject.Format = MapInfo.Mapping.ExportFormat.Bmp; / / Save to the clipboard
System.Windows.Forms.Clipboard.SetDataObject (exportObject.Export ()); / / Save to your hard drive
exportObject.Export (@ "D: \ Image.bmp");
MessageBox.Show ("Save successful!");
}
0 comments:
Post a Comment