예제 #1
0
        //Map the win32 MouseKeyState to ToolkitMouseButtons
        private ToolkitMouseButtons MapToToolkitMouseButtons(int wParam)
        {
            ToolkitMouseButtons buttons = ToolkitMouseButtons.None;

            Win32.Api.MouseKeyState fwKeys = (Win32.Api.MouseKeyState)(wParam & 0xFFFF);

            if ((fwKeys & Win32.Api.MouseKeyState.MK_LBUTTON) > 0)
            {
                buttons |= ToolkitMouseButtons.Left;
            }

            if ((fwKeys & Win32.Api.MouseKeyState.MK_MBUTTON) > 0)
            {
                buttons |= ToolkitMouseButtons.Middle;
            }

            if ((fwKeys & Win32.Api.MouseKeyState.MK_RBUTTON) > 0)
            {
                buttons |= ToolkitMouseButtons.Right;
            }

            if ((fwKeys & Win32.Api.MouseKeyState.MK_XBUTTON1) > 0)
            {
                buttons |= ToolkitMouseButtons.XButton1;
            }

            if ((fwKeys & Win32.Api.MouseKeyState.MK_XBUTTON2) > 0)
            {
                buttons |= ToolkitMouseButtons.XButton2;
            }

            return(buttons);
        }
예제 #2
0
        //Map the win32 MouseKeyState to ToolkitKeys. Alt is handled differently
        private ToolkitKeys MapMouseToToolkitKeys(int wParam)
        {
            ToolkitKeys keys = ToolkitKeys.None;

            Win32.Api.MouseKeyState fwKeys = (Win32.Api.MouseKeyState)(wParam & 0xFFFF);
            if ((fwKeys & Win32.Api.MouseKeyState.MK_CONTROL) > 0)
            {
                keys |= ToolkitKeys.Control;
            }

            if ((fwKeys & Win32.Api.MouseKeyState.MK_SHIFT) > 0)
            {
                keys |= ToolkitKeys.Shift;
            }

            if (Win32.Api.GetKeyState(Win32.Api.VirtualKeyType.VK_MENU) < 0)
            {
                keys |= ToolkitKeys.Alt;
            }

            return(keys);
        }