Exemplo n.º 1
0
 private void ZoomModeOut(bool recover = true)
 {
     MouseUtils.Rect r;
     r.Top    = int.MinValue;
     r.Bottom = int.MaxValue;
     r.Left   = int.MinValue;
     r.Right  = int.MaxValue;
     MouseUtils.ClipCursor(ref r);
     if (recover)
     {
         MouseUtils.SetCursorPos((int)previousPosition.X, (int)previousPosition.Y);
     }
 }
Exemplo n.º 2
0
        private void ZoomModeIn()
        {
            MouseUtils.GetCursorPos(out var prev);
            previousPosition.X = (double)prev.X;
            previousPosition.Y = (double)prev.Y;
            var p = PointToScreen(ZoomCanvas.TransformToAncestor(this).Transform(new Point(0, 0)));

            MouseUtils.SetCursorPos((int)(p.X + ZoomCanvas.ActualWidth / 2), (int)(p.Y + ZoomCanvas.ActualHeight / 2));

            MouseUtils.Rect r;
            r.Top    = (int)p.Y;
            r.Bottom = (int)(p.Y + ZoomCanvas.ActualHeight);
            r.Left   = (int)p.X;
            r.Right  = (int)(p.X + ZoomCanvas.ActualWidth);
            MouseUtils.ClipCursor(ref r);
        }