示例#1
0
 protected override void OnMouseDown(sw.Input.MouseButtonEventArgs e)
 {
     if (Handler.CanFocus)
     {
         swi.Keyboard.Focus(this);
     }
     base.OnMouseDown(e);
 }
示例#2
0
        public static MouseEventArgs ToEto(this swi.MouseButtonEventArgs e, sw.IInputElement control, swi.MouseButtonState buttonState = swi.MouseButtonState.Pressed)
        {
            var buttons = MouseButtons.None;

            if (e.ChangedButton == swi.MouseButton.Left && e.LeftButton == buttonState)
            {
                buttons |= MouseButtons.Primary;
            }
            if (e.ChangedButton == swi.MouseButton.Right && e.RightButton == buttonState)
            {
                buttons |= MouseButtons.Alternate;
            }
            if (e.ChangedButton == swi.MouseButton.Middle && e.MiddleButton == buttonState)
            {
                buttons |= MouseButtons.Middle;
            }
            var modifiers = Keys.None;
            var location  = e.GetPosition(control).ToEto();

            return(new MouseEventArgs(buttons, modifiers, location));
        }