示例#1
0
        /// <summary>
        /// Update the Zoom Window with a new mouse position. This means mouse have been moved and
        /// the Zoom Window needs to refresh its contents.
        /// </summary>
        /// <param name="p">New mouse position to zoom in at</param>
        private void UpdateZoomWindow(SKPoint p)
        {
            // Do we need to update at all?
            if (!windowZoom.Visible)
            {
                return;
            }

            // Get bounds of screen area to capture
            var w    = windowZoom.Bounds.Width / WindowZoomFactor;
            var h    = windowZoom.Bounds.Height / WindowZoomFactor;
            var x    = (int)(p.X - w / 2f);
            var y    = (int)(p.Y - h / 2f);
            var rect = new SKRectI(x, y, x + (int)w, y + (int)h);

            // Perform the capture and update zoom window with it
            var screenshot = screenService.Capture(rect);

            windowZoom.UpdateZoom(screenshot, WindowZoomFactor);

            // Request repaint of zoom window by using any point within it
            var invalidateAtPos = new SKPointI((int)ZoomWindowLocation.X + 1, (int)ZoomWindowLocation.Y + 1);

            screenService.Invalidate(invalidateAtPos);
        }