コード例 #1
0
ファイル: RemoteDesktop.cs プロジェクト: zoroz/Terminals
 // Handle Mouse Events:		 -------------------------------------------
 // In all cases, the same thing needs to happen: figure out where the cursor
 // is, and then figure out the state of all mouse buttons.
 // TODO: currently we don't handle the case of 3-button emulation with 2-buttons.
 protected override void OnMouseMove(MouseEventArgs mea)
 {
     // Only bother if the control is connected.
     if (IsConnected)
     {
         // See if the mouse pointer is inside the area occupied by the desktop on screen.
         Rectangle adjusted = desktopPolicy.GetMouseMoveRectangle();
         if (adjusted.Contains(PointToClient(MousePosition)))
         {
             UpdateRemotePointer();
         }
     }
     base.OnMouseMove(mea);
 }
コード例 #2
0
        private void UpdateRemotePointer()
        {
            // HACK: this check insures that while in DesignMode, no messages are sent to a VNC Host
            // (i.e., there won't be one--NullReferenceException)
            if (!DesignMode && IsConnected)
            {
                Point current = PointToClient(MousePosition);
                byte  mask    = 0;

                if (Control.MouseButtons == MouseButtons.Left)
                {
                    mask += 1;
                }
                if (Control.MouseButtons == MouseButtons.Middle)
                {
                    mask += 2;
                }
                if (Control.MouseButtons == MouseButtons.Right)
                {
                    mask += 4;
                }

                Rectangle adjusted = desktopPolicy.GetMouseMoveRectangle();
                if (adjusted.Contains(current))
                {
                    vnc.WritePointerEvent(mask, desktopPolicy.UpdateRemotePointer(current));
                }
            }
        }