此处实现的是导出axMapControl中,所有图像,成JPEG格式。

        /// <summary>
        /// 导出JPEG
        /// </summary>
        /// <param name="pActiveView"></param>
        /// <param name="IResolution"></param>
        /// <param name="fileName"></param>
        public void ExportLayerout(IActiveView pActiveView, double IResolution, string fileName)
        {
            int hdc;
            IExport pExport;
            IEnvelope pExportTileEnv, pPixelBoundsEnv;
            tagRECT exportRECT;
            try
            {
                exportRECT.left = pActiveView.ExportFrame.left * (int)(IResolution / 96);
                exportRECT.left = 0; exportRECT.top = 0;
                exportRECT.top = pActiveView.ExportFrame.top * (int)(IResolution / 96);
                exportRECT.right = pActiveView.ExportFrame.right * (int)(IResolution / 96);
                exportRECT.bottom = pActiveView.ExportFrame.bottom * (int)(IResolution / 96);

                pPixelBoundsEnv = new EnvelopeClass();
                pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);

                pExportTileEnv = new EnvelopeClass();
                pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);

                pExport = new ExportJPEGClass();
                pExport.ExportFileName = fileName;
                pExport.Resolution = IResolution;
                pExport.PixelBounds = pPixelBoundsEnv;
                hdc = pExport.StartExporting();
                pActiveView.Output(hdc, (int)pExport.Resolution, ref exportRECT, null, null);
                pExport.FinishExporting();
                pExport.Cleanup();
            }
            catch (Exception exp)
            {
            }
            finally
            {
                pExport = null;
                pExportTileEnv = null;
                pPixelBoundsEnv = null;
            }
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2021-12-11
猜你喜欢
  • 2022-12-23
  • 2022-01-20
  • 2021-12-08
  • 2022-02-09
  • 2022-12-23
  • 2023-01-31
  • 2021-12-05
相关资源
相似解决方案