globe没有mousewheel事件,
public partial class Form1 : Form
{
//TOC菜单
IFeatureLayer pTocFeatureLayer = null; //点击的要素图层
private FormAtrribute frmAttribute = null; //图层属性窗体
//private ILayer pMoveLayer; //需要调整显示顺序的图层
//private int toIndex; //存放拖动图层移动到的索引号
public Form1()
{
InitializeComponent();
/ /向Arcglobe中添加鼠标滚轮放大缩小功能
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.axGlobeControl1_OnMouseWheel);
}
private void axGlobeControl1_OnMouseWheel(object sender, MouseEventArgs e)
{
//将axGlobeControl1相对于软件的坐标,变换成屏幕坐标
System.Drawing.Point pSceLoc = axGlobeControl1.PointToScreen(axGlobeControl1.Location);
//将鼠标所在位置坐标变换成屏幕坐标
System.Drawing.Point Pt = this.PointToScreen(e.Location);
//判断鼠标是否在屏幕外,如果是返回,无操作
if (Pt.X < pSceLoc.X || Pt.X > pSceLoc.X + axGlobeControl1.Width || Pt.Y < pSceLoc.Y || Pt.Y > pSceLoc.Y + axGlobeControl1.Height)
{
return;
}
double scale = 0.2;
if (e.Delta > 0) scale = -scale;
//IGlobeCamera pGlobeCamera = axGlobeControl1.GlobeCamera;
//ICamera pCamera = pGlobeCamera as ICamera;
//IGlobeDisplay pGlobeDisplay = axGlobeControl1.GlobeDisplay;
ESRI.ArcGIS.GlobeCore.IGlobeCamera pGlobeCamera = axGlobeControl1.GlobeCamera;
ESRI.ArcGIS.Analyst3D.ICamera pCamera = pGlobeCamera as ESRI.ArcGIS.Analyst3D.ICamera;
ESRI.ArcGIS.GlobeCore.IGlobeDisplay pGlobeDisplay = axGlobeControl1.GlobeDisplay;
// if (pGlobeCamera.OrientationMode == esriGlobeCameraOrientationMode.esriGlobeCameraOrientationGlobal)
if (pGlobeCamera.OrientationMode == ESRI.ArcGIS.GlobeCore.esriGlobeCameraOrientationMode.esriGlobeCameraOrientationGlobal)
{
double xo, yo, zo;
pGlobeCamera.GetObserverLatLonAlt(out xo, out yo, out zo);
zo = zo * (1 + scale);
pGlobeCamera.SetObserverLatLonAlt(xo, yo, zo);
}
else
{
pCamera.ViewingDistance += pCamera.ViewingDistance * scale;
}
axGlobeControl1.GlobeDisplay.RefreshViewers();
}