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;
}