zoukankan      html  css  js  c++  java
  • ArcEngine导出图片 转载

    原文链接http://bbs.gissky.net/blog.asp?id=114

    ArcEngine中导出图片的过程如下:
    1.建立导出类(IExport的实例);
    2.准备要导出的范围
    3.开始导出(从导出类中获取DC)
    4.调用IActiveView的Output方法
    5.结束导出
    6.清除导出类
    范例代码如下:
          //获取保存文件的路径/建立导出类
       System.Windows.Forms.SaveFileDialog sfd=new SaveFileDialog();
       sfd.Filter="*.tif|*.tif|*.jpeg|*.jpeg|*.pdf|*.pdf|*.bmp|*.bmp";
       if(sfd.ShowDialog((Form)this.m_appRef)==DialogResult.OK)
       {
        IExport pExport=null;
        if(1==sfd.FilterIndex)
        {
         pExport=new ExportTIFFClass();
        } 
        else if(2==sfd.FilterIndex)
        {
         pExport=new ExportJPEGClass();
        } 
        else if(3==sfd.FilterIndex)
        {
         pExport=new ExportPDFClass();
        } 
        else if(4==sfd.FilterIndex)
        {
         pExport=new ExportBMPClass();
        } 
        pExport.ExportFileName=sfd.FileName;
        设置参数
        //默认精度              
        int reslution=96;    
        pExport.Resolution = reslution;
        //获取导出范围
        tagRECT exportRECT=m_pActiveView.ExportFrame;
        IEnvelope pPixelBoundsEnv =new EnvelopeClass();
        pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
        pExport.PixelBounds = pPixelBoundsEnv;
        //开始导出,获取DC  
        int hDC = pExport.StartExporting();
        IEnvelope pVisbounds=null;
        ITrackCancel ptrac=null;
        //导出
        m_pActiveView.Output(hDC,(int)pExport.Resolution,ref exportRECT, pVisbounds, ptrac);
        //结束导出
        pExport.FinishExporting();
        //清理导出类
        pExport.Cleanup(); 

  • 相关阅读:
    寒假学习记录19
    寒假学习记录18
    寒假学习记录17
    寒假学习记录16
    寒假学习记录15
    寒假学习记录14
    寒假学习记录13
    寒假学习记录12
    寒假学习记录11
    学习进度(10)
  • 原文地址:https://www.cnblogs.com/hl3292/p/1914069.html
Copyright © 2011-2022 走看看