Пример #1
0
        public PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind)
        {
            PointerUpdateKind     = kind;
            IsLeftButtonPressed   = modifiers.HasFlagCustom(RawInputModifiers.LeftMouseButton);
            IsMiddleButtonPressed = modifiers.HasFlagCustom(RawInputModifiers.MiddleMouseButton);
            IsRightButtonPressed  = modifiers.HasFlagCustom(RawInputModifiers.RightMouseButton);

            // The underlying input source might be reporting the previous state,
            // so make sure that we reflect the current state

            if (kind == PointerUpdateKind.LeftButtonPressed)
            {
                IsLeftButtonPressed = true;
            }
            if (kind == PointerUpdateKind.LeftButtonReleased)
            {
                IsLeftButtonPressed = false;
            }
            if (kind == PointerUpdateKind.MiddleButtonPressed)
            {
                IsMiddleButtonPressed = true;
            }
            if (kind == PointerUpdateKind.MiddleButtonReleased)
            {
                IsMiddleButtonPressed = false;
            }
            if (kind == PointerUpdateKind.RightButtonPressed)
            {
                IsRightButtonPressed = true;
            }
            if (kind == PointerUpdateKind.RightButtonReleased)
            {
                IsRightButtonPressed = false;
            }
        }
Пример #2
0
 private DragDropEffects GetPreferredEffect(DragDropEffects effect, RawInputModifiers modifiers)
 {
     if (effect == DragDropEffects.Copy || effect == DragDropEffects.Move || effect == DragDropEffects.Link || effect == DragDropEffects.None)
     {
         return(effect); // No need to check for the modifiers.
     }
     if (effect.HasFlagCustom(DragDropEffects.Link) && modifiers.HasFlagCustom(RawInputModifiers.Alt))
     {
         return(DragDropEffects.Link);
     }
     if (effect.HasFlagCustom(DragDropEffects.Copy) && modifiers.HasFlagCustom(RawInputModifiers.Control))
     {
         return(DragDropEffects.Copy);
     }
     return(DragDropEffects.Move);
 }