ArcEngine输出当前显示范围为JPG图像

实现函数如下:

        /// <summary>
        /// 输出当前显示范围为JPG图像
        /// </summary>
        /// <param name="IN_Envolope">显示范围</param>
        /// <param name="IN_SaveFile">保存路径</param>
        /// <param name="IN_AxmapControl">显示控件</param>
        private void PRV_ExportToJPG(IEnvelope IN_Envolope, string IN_SaveFile,AxMapControl IN_AxmapControl)
        {
            //默认为当前显示区域
            if (IN_Envolope == null)
                IN_Envolope = IN_AxmapControl.ActiveView.Extent;
            //输出为JPG
            IExport Temp_Exporter = new ExportJPEGClass(); ;
            //获取活动窗体
            IActiveView Temp_CurrentActiveView = IN_AxmapControl.ActiveView;
            //要素实际宽高
            int Temp_featureWidth = (int)(IN_Envolope.Width);
            int Temp_featureHeight = (int)(IN_Envolope.Height);
            //根据要素实际情况确定图片实际大小
            tagRECT Temp_TtagRECT;
            Temp_TtagRECT.left = 0;
            Temp_TtagRECT.top = 0;
            Temp_TtagRECT.right = (int)(IN_Envolope.Width) * 10;//保证显示效果良好,不挤在一起
            Temp_TtagRECT.bottom = (int)(IN_Envolope.Height) * 10;
            //定义DPI
            int Temp_DPI = 100;
            //设定输出参数
            IEnvelope Temp_Envelope = new EnvelopeClass();
            Temp_Envelope.PutCoords(Temp_TtagRECT.left, Temp_TtagRECT.top, Temp_TtagRECT.right, Temp_TtagRECT.bottom);
            Temp_Exporter.Resolution = Temp_DPI;
            Temp_Exporter.ExportFileName = IN_SaveFile;
            Temp_Exporter.PixelBounds = Temp_Envelope;
            //输出
            Temp_CurrentActiveView.Output(Temp_Exporter.StartExporting(), Temp_DPI, ref Temp_TtagRECT, IN_Envolope, null);
            Temp_Exporter.FinishExporting();
            //释放资源
            System.Runtime.InteropServices.Marshal.ReleaseComObject(Temp_Exporter);
        }


转载自:https://blog.csdn.net/u011609113/article/details/51347688

You may also like...