예제 #1
0
        protected virtual void RaiseHwndMouseWheel(HwndMouseEventArgs args)
        {
            var handler = HwndMouseWheel;

            if (handler != null)
            {
                handler(this, args);
            }
        }
예제 #2
0
        protected virtual void RaiseHwndX1ButtonUp(HwndMouseEventArgs args)
        {
            var handler = HwndX1ButtonUp;

            if (handler != null)
            {
                handler(this, args);
            }
        }
예제 #3
0
        protected virtual void RaiseHwndX2ButtonDblClick(HwndMouseEventArgs args)
        {
            var handler = HwndX2ButtonDblClick;

            if (handler != null)
            {
                handler(this, args);
            }
        }
예제 #4
0
        /// <summary>
        /// Resets the mouse state.
        /// </summary>
        private void ResetMouseState()
        {
            // We need to invoke events for any buttons that were pressed
            bool fireL  = _mouseState.LeftButton == MouseButtonState.Pressed;
            bool fireM  = _mouseState.MiddleButton == MouseButtonState.Pressed;
            bool fireR  = _mouseState.RightButton == MouseButtonState.Pressed;
            bool fireX1 = _mouseState.X1Button == MouseButtonState.Pressed;
            bool fireX2 = _mouseState.X2Button == MouseButtonState.Pressed;

            // Update the state of all of the buttons
            _mouseState.LeftButton   = MouseButtonState.Released;
            _mouseState.MiddleButton = MouseButtonState.Released;
            _mouseState.RightButton  = MouseButtonState.Released;
            _mouseState.X1Button     = MouseButtonState.Released;
            _mouseState.X2Button     = MouseButtonState.Released;

            // Fire any events
            var args = new HwndMouseEventArgs(_mouseState);

            if (fireL)
            {
                RaiseHwndLButtonUp(args);
            }
            if (fireM)
            {
                RaiseHwndMButtonUp(args);
            }
            if (fireR)
            {
                RaiseHwndRButtonUp(args);
            }
            if (fireX1)
            {
                RaiseHwndX1ButtonUp(args);
            }
            if (fireX2)
            {
                RaiseHwndX2ButtonUp(args);
            }

            // The mouse is no longer considered to be in our window
            _mouseInWindow = false;
        }