zoukankan      html  css  js  c++  java
  • 保存为栅格图片-MapControl截图——保存ActiveView为jpg图片

     1 ///<summary>Creates a .jpg (JPEG) file from IActiveView. Default values of 96 DPI are used for the image creation.</summary>
     2 ///
     3 ///<param name="activeView">An IActiveView interface</param>
     4 ///<param name="pathFileName">A System.String that the path and filename of the JPEG you want to create. Example: "C:	emp	est.jpg"</param>
     5 /// 
     6 ///<returns>A System.Boolean indicating the success</returns>
     7 /// 
     8 ///<remarks></remarks>
     9 public System.Boolean CreateJPEGFromActiveView(ESRI.ArcGIS.Carto.IActiveView activeView, System.String pathFileName)
    10 {
    11   //parameter check
    12   if (activeView == null || !(pathFileName.EndsWith(".jpg")))
    13   {
    14     return false;
    15   }
    16   ESRI.ArcGIS.Output.IExport export = new ESRI.ArcGIS.Output.ExportJPEGClass();
    17   export.ExportFileName = pathFileName;
    18 
    19   // Microsoft Windows default DPI resolution
    20   export.Resolution = 96;
    21   ESRI.ArcGIS.Display.tagRECT exportRECT = activeView.ExportFrame;
    22   ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
    23   envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
    24   export.PixelBounds = envelope;
    25   System.Int32 hDC = export.StartExporting();
    26   activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null);
    27 
    28   // Finish writing the export file and cleanup any intermediate files
    29   export.FinishExporting();
    30   export.Cleanup();
    31 
    32   return true;
    33 }

    源:http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Create_JPEG_from_ActiveView_Snippet/004900000064000000/

  • 相关阅读:
    ggplot2|theme主题设置,详解绘图优化-“精雕细琢”-
    ggplot2|theme主题设置,详解绘图优化-“精雕细琢”
    阻抗设计01
    Geber文件,装配图,BOM表的输出
    c语言里面你不知道的break与switch,contiune的用法
    数据结构之链表学习01
    数据结构概念及连续存储数组的算法演示
    使用malloc和free函数进行内存动态分配
    浅谈结构体
    浅谈指针01
  • 原文地址:https://www.cnblogs.com/xuchen/p/5844459.html
Copyright © 2011-2022 走看看