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(); 

转载于:https://www.cnblogs.com/hl3292/archive/2010/12/22/1914069.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值