void Target_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (sender as FrameworkElement == null) { throw new ArgumentException("CoreMouseEvent.cs/CoreMouseEventProcessor/Target_PreviewMouseDown : Can't cover sender to FrameworkElement"); } FrameworkElement Target = sender as FrameworkElement; MousePressedPoint = e.GetPosition(Target); if (Enable[MouseDown]) { CoreMouseEventArgs info1 = new CoreMouseDownEventArgs(CoreMouseEventProcessor.MouseDown, CoreMouseDownEventArgs.LeftButton, e.GetPosition(Target), e.ClickCount); CoreMouseEventArgs info2 = new CoreMouseDownEventArgs(CoreMouseEventProcessor.MouseDown, CoreMouseDownEventArgs.RightButton, e.GetPosition(Target), e.ClickCount); if (e.ChangedButton == MouseButton.Left) { OnMouseEvent(info1, Target); } if (e.ChangedButton == MouseButton.Right) { OnMouseEvent(info2, Target); } } if (e.ChangedButton == MouseButton.Left) { MouseLeftPressed = true; } if (e.ChangedButton == MouseButton.Right) { MouseRightPressed = true; } }
void Target_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (sender as FrameworkElement == null) throw new ArgumentException("CoreMouseEvent.cs/CoreMouseEventProcessor/Target_PreviewMouseDown : Can't cover sender to FrameworkElement"); FrameworkElement Target = sender as FrameworkElement; MousePressedPoint = e.GetPosition(Target); if (Enable[MouseDown]) { CoreMouseEventArgs info1 = new CoreMouseDownEventArgs(CoreMouseEventProcessor.MouseDown, CoreMouseDownEventArgs.LeftButton, e.GetPosition(Target), e.ClickCount); CoreMouseEventArgs info2 = new CoreMouseDownEventArgs(CoreMouseEventProcessor.MouseDown, CoreMouseDownEventArgs.RightButton, e.GetPosition(Target), e.ClickCount); if (e.ChangedButton == MouseButton.Left) OnMouseEvent(info1, Target); if (e.ChangedButton == MouseButton.Right) OnMouseEvent(info2, Target); } if (e.ChangedButton == MouseButton.Left) MouseLeftPressed = true; if (e.ChangedButton == MouseButton.Right) MouseRightPressed = true; }