示例#1
0
        private static bool HandleMouseEvent(NativeMouseEvent eventCode, MousePosition pos, int wheelDelta)
        {
            switch (eventCode)
            {
            case NativeMouseEvent.WM_MOUSEMOVE:
                OnMouseMove?.Invoke(pos);
                return(true);

            case NativeMouseEvent.WM_LBUTTONDOWN:
                OnMouseLeftDown?.Invoke(pos);
                return(true);

            case NativeMouseEvent.WM_LBUTTONUP:
                OnMouseLeftUp?.Invoke(pos);
                return(true);

            case NativeMouseEvent.WM_RBUTTONDOWN:
                OnMouseRightDown?.Invoke(pos);
                return(true);

            case NativeMouseEvent.WM_RBUTTONUP:
                OnMouseRightUp?.Invoke(pos);
                return(true);

            case NativeMouseEvent.WM_MOUSEWHEEL:
                OnMouseWheel?.Invoke(pos, wheelDelta);
                return(true);

            default:
                return(false);
            }
        }
示例#2
0
 public virtual void MouseRightDown(UIMouseEvent e)
 {
     //Main.NewText("右键按下");
     OnMouseRightDown?.Invoke(e, this);
     if (PropagationRule.HasFlag(PropagationFlags.MouseRightDown))
     {
         Parent?.MouseRightDown(e);
     }
 }
示例#3
0
 private void NotifyMouseRightDown()
 {
     OnMouseRightDown?.Invoke(this, EventArgs.Empty);
 }
示例#4
0
        LRESULT WndProc(HWND hwnd, WM msg, WPARAM wParam, LPARAM lParam)
        {
            switch (msg)
            {
            case WM.CLOSE:
                OnClose?.Invoke();
                if (DestroyWhenClose == null || DestroyWhenClose())
                {
                    User32.DestroyWindow(hwnd);
                }
                return(0);

            case WM.ENABLE:
                OnEnable?.Invoke(wParam);
                break;

            case WM.SHOWWINDOW:
                OnShow?.Invoke(wParam);
                break;

            case WM.DESTROY:
                OnDestroy?.Invoke();
                return(0);

            case WM.MOUSEMOVE:
                OnMouseMove?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.LBUTTONDOWN:
                OnMouseLeftDown?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.LBUTTONUP:
                OnMouseLeftUp?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.LBUTTONDBLCLK:
                OnMouseLeftDoubleClicked?.Invoke();
                return(0);

            case WM.RBUTTONDOWN:
                OnMouseRightDown?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.RBUTTONUP:
                OnMouseRightUp?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.MBUTTONDOWN:
                OnMouseMiddleDown?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.MBUTTONUP:
                OnMouseMiddleUp?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.MOUSEWHEEL:
                OnMouseWheel?.Invoke(wParam.HiWord);
                return(0);

            case WM.RESIZE:
                OnResize?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.PAINT:
            {
                var ps = default(PAINTSTRUCT);
                User32.BeginPaint(hwnd, ref ps);
                OnPaint?.Invoke();
                User32.EndPaint(hwnd, ref ps);
            }
                return(0);
            }
            return(User32.DefWindowProcW(hwnd, msg, wParam, lParam));
        }
示例#5
0
 internal void CallMouseRightDown()
 {
     IsMouseRightPressed = true;
     OnMouseRightDown?.Invoke();
     OnAnyMouseDown?.Invoke();
 }