Пример #1
0
        private void SpaceGrid_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            var          fe       = sender as FrameworkElement;
            PointerPoint ptrPt    = e.GetCurrentPoint(fe);
            Point        position = ptrPt.Position;

            if (ptrPt.Properties.IsLeftButtonPressed)
            {
                m_MouseEventCtrl.OnMouseMoved(position, true);
                bool _hasCapture = fe.CapturePointer(e.Pointer);
            }
            else
            {
                m_MouseEventCtrl.OnMouseMoved(position, false);
                return; // no need to draw mouse rectangle
            }

            // Draw mouse rectangle
            Rect r = m_MouseEventCtrl.MouseRect;
            TranslateTransform tt = MouseRectangle.RenderTransform as TranslateTransform;

            tt.X = r.X;
            tt.Y = r.Y;
            MouseRectangle.Width  = r.Width;
            MouseRectangle.Height = r.Height;
        }
Пример #2
0
        private void SpaceGrid_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            var          fe       = sender as FrameworkElement;
            PointerPoint ptrPt    = e.GetCurrentPoint(fe);
            Point        Position = ptrPt.Position;

            if (ptrPt.Properties.IsLeftButtonPressed)
            {
                gMouseEventCtrl.OnMouseMoved(Position, true);
                bool _hasCapture = fe.CapturePointer(e.Pointer);
            }
            else
            {
                gMouseEventCtrl.OnMouseMoved(Position, false);
            }
        }