Страница 1 из 1
Копирование области axMapControl to clibboard
Добавлено: 17 июл 2012, 16:08
Tereha
Уважаемые Гуру!
Может ли кто-то подсказать как скопировать область axMapControl to clipboard?
Thanks in advance!
Re: Копирование области axMapControl to clibboard
Добавлено: 26 июл 2012, 11:53
Tereha
Пример как можно скопировать картинку в bitmap:
Код: Выделить всё
private Image makeImageFromActiveScreen(IActiveView activeView)
{
//parameter check
if (activeView == null)
{
return null;
}
ESRI.ArcGIS.Output.IExport export = new ExportBMPClass();
// Microsoft Windows default DPI resolution
export.Resolution = 96;
// ESRI.ArcGIS.Display.tagRECT exportRECT = activeView.ExportFrame;
tagRECT exportRECT = activeView.ExportFrame;
ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
export.PixelBounds = envelope;
System.Int32 hDC = export.StartExporting();
activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null);
Bitmap myImage = Image.FromHbitmap(new IntPtr((export as IExportBMP).Bitmap));
// Finish writing the export file and cleanup any intermediate files
export.FinishExporting();
export.Cleanup();
return myImage;
}
Затем ее можно взять в clipboard например так:
Код: Выделить всё
Image img = makeImageFromActiveScreen(activeView);
System.Windows.Forms.Clipboard.SetDataObject(img);