zoukankan      html  css  js  c++  java
  • 代码实现IMapcontrol当前视图输出为图片功能

     1 SaveFileDialog dialog = new SaveFileDialog();
     2             dialog.Title = "保存输出图片";
     3             dialog.Filter = "JPG文件(*.jpg)|*.jpg|BMP文件(*.bmp)|*.bmp||";
     4             if (dialog.ShowDialog() == DialogResult.OK)
     5             {
     6                 tagRECT grect;
     7                 string str = System.IO.Path.GetExtension(dialog.FileName).ToLower();
     8                 IExport export = null;
     9                 if (str == ".jpg")
    10                 {
    11                     export = new ExportJPEGClass();
    12                 }
    13                 else
    14                 {
    15                     export = new ExportBMPClass();
    16                 }
    17                 export.ExportFileName = dialog.FileName;
    18                 int num = 0x60;
    19                 int num2 = 300;
    20                 export.Resolution = num2;
    21                 grect.left = 0;
    22                 grect.top = 0;
    23                 tagRECT deviceFrame = this.m_pMapControl.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame();//.DeviceFrame;
    24                 grect.right = (int) (((deviceFrame.right - deviceFrame.left) * num2) / ((double) num));
    25                 grect.bottom = (int) (((deviceFrame.bottom - deviceFrame.top) * num2) / ((double) num));
    26                 IEnvelope envelope = new EnvelopeClass();
    27                 envelope.PutCoords((double) grect.left, (double) grect.top, (double) grect.right, (double) grect.bottom);
    28                 export.PixelBounds = envelope;
    29                 int hdc = export.StartExporting();
    30                 double resolution = export.Resolution;
    31                 this.m_pMapControl.ActiveView.Output(hdc, (int) resolution, ref grect, null, null);
    32                 export.FinishExporting();
    33                 export.Cleanup();
    34             }
    View Code
  • 相关阅读:
    Android之Handler
    错误一览表
    Android ImageView 的scaletype属性详细介绍 转
    Adobe Flash/Dreamweaver/Fireworks CS3 软件不能安装问题
    MySQL修改表属性的SQL语句
    Apache与Tomcat整合
    mySQL常用SQL语句技法
    今天第一次写博客
    Tomcat+JSP经典配置实例
    整合Apache+Tomcat服务器2
  • 原文地址:https://www.cnblogs.com/fatherZyl/p/3287062.html
Copyright © 2011-2022 走看看