• SceneControl+AE+鼠标滚轮缩放


    要为SceneControl设置鼠标滚轮缩放必须定义委托,因为SceneControl没有Wheel事件,所以委托From的Wheel事件

     1 public Form1()
     2 {
     3        InitializeComponent();
     4        this.MouseWheel += new MouseEventHandler(this.SceneControl_MouseWheel); //在这个地方输入"this.MouseWheel+=”后连续按两次Tab键
     5 }
     6 private void SceneControl_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
     7         {
     8             try
     9             {
    10                 axSceneControl1.MousePointer = esriControlsMousePointer.esriPointerZoom;
    11                 System.Drawing.Point pSceneLocation = axSceneControl1.PointToScreen(axSceneControl1.Location);
    12                 System.Drawing.Point Pt = axSceneControl1.PointToScreen(e.Location);
    13                 if (Pt.X < pSceneLocation.X | Pt.X > pSceneLocation.X + axSceneControl1.Width | Pt.Y < pSceneLocation.Y | Pt.Y > pSceneLocation.Y + axSceneControl1.Height)
    14                     return;
    15                 double scale = 0.2;
    16                 if (e.Delta < 0) scale = -0.2;
    17                 ICamera pCamera = axSceneControl1.Camera;
    18                 IPoint pObserver = pCamera.Observer;
    19                 IPoint pTarget = pCamera.Target;
    20                 pObserver.X += (pObserver.X - pTarget.X) * scale;
    21                 pObserver.Y += (pObserver.Y - pTarget.Y) * scale;
    22                 pObserver.Z += (pObserver.Z - pTarget.Z) * scale;
    23                 pCamera.Observer = pObserver;
    24                 axSceneControl1.SceneGraph.RefreshViewers();
    25                 //this.Text = e.Delta.ToString();
    26             }
    27             catch (Exception ex)
    28             {
    29                 MessageBox.Show(ex.Message);
    30             }
    31         }
  • 相关阅读:
    [OS] 信号量(Semaphore)
    [OS] 进程互斥
    [剑指Offer] 52.正则表达式匹配
    [剑指Offer] 51.构建乘积数组
    [剑指Offer] 50.数组中重复的数字
    [剑指Offer] 49.把字符串转换成整数
    [剑指Offer] 48.不用加减乘除做加法
    [剑指Offer] 47.求1+2+3+...+n
    PHP知识库图谱汇总(完善中)
    修改thinkphp路由模式,去掉Home
  • 原文地址:https://www.cnblogs.com/qiernonstop/p/3644825.html
Copyright © 2020-2023  润新知