Esempio n. 1
0
        // TODO: Perhaps overload UpdateRemotePointer to take a flag indicating if mousescroll has occured??
        //protected override void OnMouseWheel(MouseEventArgs mea)
        //{
        //  // 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;

        //    // mouse was scrolled forward
        //    if (mea.Delta > 0)
        //    {
        //      mask += 8;
        //    }
        //    else if (mea.Delta < 0)
        //    { // mouse was scrolled backwards
        //      mask += 16;
        //    }

        //    vnc.WritePointerEvent(mask, desktopPolicy.GetMouseMovePoint(current));
        //  }
        //  base.OnMouseWheel(mea);
        //}

        private void UpdateRemotePointer()
        {
            if (IsConnected)
            {
                System.Drawing.Point current =
                    new System.Drawing.Point((int)mousePosition.X, (int)mousePosition.Y);
                byte mask = 0;

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

                if (current.X < 0 || current.Y < 0)
                {
                    return;
                }
                //throw new Exception("Crazy value for mouse pointer!");

                vnc.WritePointerEvent(mask, current);
            }
        }
Esempio n. 2
0
        protected override void OnMouseWheel(MouseEventArgs mea)
        {
            // (i.e., there won't be one--NullReferenceException)
            if (!DesignMode && IsConnected)
            {
                Point current = PointToClient(MousePosition);
                byte  mask    = 0;

                // mouse was scrolled forward
                if (mea.Delta > 0)
                {
                    mask += 8;
                }
                else if (mea.Delta < 0)                     // mouse was scrolled backwards
                {
                    mask += 16;
                }

                vnc.WritePointerEvent(mask, desktopPolicy.GetMouseMovePoint(current));
            }
            base.OnMouseWheel(mea);
        }
        // TODO: Perhaps overload UpdateRemotePointer to take a flag indicating if mousescroll has occured??
        protected override void OnMouseWheel(MouseEventArgs mea)
        {
            // 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)
            {
                var  current = PointToClient(MousePosition);
                byte mask    = 0;

                // mouse was scrolled forward
                if (mea.Delta > 0)
                {
                    mask += 8;
                }
                else if (mea.Delta < 0)
                {
                    mask += 16;
                }

                vnc.WritePointerEvent(mask, desktopPolicy.GetMouseMovePoint(current));
            }
            base.OnMouseWheel(mea);
        }