你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
朱新颖
赞同来自: 攘外必先安内内
private bool NewExport(IActiveView activeView, string pathFileName, int pOutDPI) { if (activeView == null || !(pathFileName.EndsWith(.tif))) { return false; } IExport pExport = new ExportTIFFClass(); //创建输出对象 pExport.ExportFileName = pathFileName; //定义输出图片位置 int screenResolution = 96; //屏幕分辨率 int outputResulotion = pOutDPI; pExport.Resolution = outputResulotion; //定义输出图片分辨率 tagRECT exportRECT; exportRECT.left = 0; exportRECT.top = 0; exportRECT.right = activeView.ExportFrame.right * (outputResulotion / screenResolution); exportRECT.bottom = activeView.ExportFrame.bottom * (outputResulotion / screenResolution); //获取当前要输出的区域 // Set up the PixelBounds envelope to match the exportRECT IEnvelope pExportEnv = new EnvelopeClass(); pExportEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom); pExport.PixelBounds = pExportEnv; //设置输出图片大小 IExportTIFF exportTiff = pExport as IExportTIFF; exportTiff.GeoTiff = true; exportTiff.CompressionType = esriTIFFCompression.esriTIFFCompressionLZW; IWorldFileSettings worldFileSet = pExport as IWorldFileSettings; worldFileSet.MapExtent = activeView.Extent; int hDC = pExport.StartExporting(); activeView.Output(hDC, Convert.ToInt32(outputResulotion), ref exportRECT, null, null); //输出图片 pExport.FinishExporting(); //结束输出 pExport.Cleanup(); //清理临时文件、释放内存 return true; }
要回复问题请先登录或注册
1 个回复
朱新颖
赞同来自: 攘外必先安内内
需要设置IExportTIFF.GeoTiff 为true; 并且设置IWorldFileSettings.MapExtent,可以参考下面代码:
调用代码:
NewExport(axMapControl1.ActiveView, @D:\zxy.tif, 120);
函数为:
要回复问题请先登录或注册