public double calcMapScale(IActiveView activeView,double iDevUnit) //后面参数为像素值
{
double mapUnits=0.01;
IScreenDisplay pSd=activeView.ScreenDisplay;
if(pSd!=null)
{
//获取地图空间的像素宽度
IDisplayTransformation pDtf=pSd.DisplayTransformation;
tagRECT tagRect=pDtf.get_DeviceFrame();
int iPixelWid=ragRect.Right-ragRect.left;
//获取当前地图视图的地理宽度
IEnvelope pExtentEnve=activeView.Extent;
mapUnits=pExtentEnve.Width/iPixelWid * iDevUnit;
}
return mapUnits;
}