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
  • 相关阅读:
    产品需求说明书PRD模版
    会编程的 AI + 会修 Bug 的 AI,等于什么 ?
    会编程的 AI + 会修 Bug 的 AI,等于什么 ?
    会编程的 AI + 会修 Bug 的 AI,等于什么 ?
    luogu P1164 小A点菜
    luogu P1347 排序
    luogu P1195 口袋的天空
    luogu P1182 数列分段Section II
    luogu P1332 血色先锋队
    luogu P1983 车站分级
  • 原文地址:https://www.cnblogs.com/fatherZyl/p/3287062.html
Copyright © 2011-2022 走看看