예제 #1
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (this.IsMouseCaptured)
     {
         this.IsPressed = this.WithinBounds(e.GetPosition(this));
     }
 }
예제 #2
0
        private bool ProcessRawMouseEvent(RawMouseEventArgs input)
        {
            MouseEventArgs e = null;

            switch (input.Type)
            {
                case RawMouseEventType.Move:
                    e = new MouseEventArgs(this, input.Timestamp);
                    e.RoutedEvent = UIElement.MouseMoveEvent;
                    break;

                case RawMouseEventType.LeftButtonDown:
                    e = new MouseButtonEventArgs(this, input.Timestamp);
                    e.RoutedEvent = UIElement.MouseLeftButtonDownEvent;
                    break;

                case RawMouseEventType.LeftButtonUp:
                    e = new MouseButtonEventArgs(this, input.Timestamp);
                    e.RoutedEvent = UIElement.MouseLeftButtonUpEvent;
                    break;
            }

            if (e != null)
            {
                InputManager.Current.ProcessInput(e);
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #3
0
 protected virtual void OnMouseMove(MouseEventArgs e)
 {
 }
예제 #4
0
        private void UpdateUIElementMouseOvers()
        {
            IEnumerable<UIElement> current = this.ElementAndAncestors(this.Target);

            foreach (UIElement ui in current.Except(this.mouseOvers))
            {
                ui.SetValue(UIElement.IsMouseOverProperty, true);
                this.mouseOvers.Add(ui);

                MouseEventArgs e = new MouseEventArgs(this, Environment.TickCount);
                e.RoutedEvent = UIElement.MouseEnterEvent;
                ui.RaiseEvent(e);
            }

            foreach (UIElement ui in this.mouseOvers.Except(current).ToArray())
            {
                ui.SetValue(UIElement.IsMouseOverProperty, false);
                this.mouseOvers.Remove(ui);

                MouseEventArgs e = new MouseEventArgs(this, Environment.TickCount);
                e.RoutedEvent = UIElement.MouseLeaveEvent;
                ui.RaiseEvent(e);
            }
        }
예제 #5
0
 protected virtual void OnMouseEnter(MouseEventArgs e)
 {
 }