zoukankan      html  css  js  c++  java
  • ArcGIS Engine 导出图片格式(代码示例)

      

        private void MenuItemExportJPEG_Click(object sender, EventArgs e)
            {
                try
                {
                    SaveFileDialog exportJPGDialog = new SaveFileDialog();
                    exportJPGDialog.Title = "导出JPEG图像";
                    exportJPGDialog.Filter = "Jpeg Files(*.jpg,*.jpeg)|*.jpg,*.jpeg";
                    exportJPGDialog.RestoreDirectory = true;
                    exportJPGDialog.ValidateNames = true;
                    exportJPGDialog.OverwritePrompt = true;
                    exportJPGDialog.DefaultExt = "jpg";
    
                    if (exportJPGDialog.ShowDialog() == DialogResult.OK)
                    {
                        double lScreenResolution;
                        lScreenResolution = axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.Resolution;
    
                        IExport pExporter = new ExportJPEGClass() as IExport;
                        //IExport pExporter = new ExportPDFClass() as IExport;//直接可以用!!
                        pExporter.ExportFileName = exportJPGDialog.FileName;
                        pExporter.Resolution = lScreenResolution;
    
                        tagRECT deviceRECT;
                        //用这句的话执行到底下的output()时就会出现错误:Not enough memory to create requested bitmap
                        //MainaxMapControl.ActiveView.ScreenDisplay.DisplayTransformation.set_DeviceFrame(ref deviceRECT);
                        deviceRECT = axMapControl1.ActiveView.ExportFrame;
    
                        IEnvelope pDriverBounds = new EnvelopeClass();
                        //pDriverBounds = MainaxMapControl.ActiveView.FullExtent;
    
                        pDriverBounds.PutCoords(deviceRECT.left, deviceRECT.bottom, deviceRECT.right, deviceRECT.top);
    
                        pExporter.PixelBounds = pDriverBounds;
    
                        ITrackCancel pCancel = new CancelTrackerClass();
                        axMapControl1.ActiveView.Output(pExporter.StartExporting(), (int)lScreenResolution, ref deviceRECT, axMapControl1.ActiveView.Extent, pCancel);
                        pExporter.FinishExporting();
                        pExporter.Cleanup();
                        MessageBox.Show("导出Jpeg图像成功!图像保存在" + exportJPGDialog.FileName, "保存成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                { MessageBox.Show(ex.Message); return; }
            }



  • 相关阅读:
    互联网公司笔试常见陷阱
    华为机试题(地铁换乘,图的应用)
    容器(vector)、数组、new创建的动态数组,你到底用哪一个(执行效率分析)
    SpringMVC全局异常
    github commit contributions无记录
    elasticSearch之查询
    nginx负载均衡策略
    docker入门
    解决centos&win安装安装elasticSearch无法运行
    2017年终总结
  • 原文地址:https://www.cnblogs.com/tuboshu/p/10752397.html
Copyright © 2011-2022 走看看