/// <summary> /// update the frame, this only invalidates /// </summary> protected override void Animate() { Point lastPos = cursorPos.Clone(); cursorPos = mouseMovePos.Clone(); if (selectedCaptureWindow != null && lastPos.Equals(cursorPos) && !isAnimating(zoomAnimator) && !isAnimating(windowAnimator)) { return; } Rectangle lastCaptureRect = new Rectangle(captureRect.Location, captureRect.Size); WindowDetails lastWindow = selectedCaptureWindow; bool horizontalMove = false; bool verticalMove = false; if (lastPos.X != cursorPos.X) { horizontalMove = true; } if (lastPos.Y != cursorPos.Y) { verticalMove = true; } if (captureMode == CaptureMode.Region && mouseDown) { captureRect = GuiRectangle.GetGuiRectangle(cursorPos.X, cursorPos.Y, mX - cursorPos.X, mY - cursorPos.Y); } // Iterate over the found windows and check if the current location is inside a window Point cursorPosition = Cursor.Position; selectedCaptureWindow = null; lock (windows) { foreach (WindowDetails window in windows) { if (window.Contains(cursorPosition)) { // Only go over the children if we are in window mode if (CaptureMode.Window == captureMode) { selectedCaptureWindow = window.FindChildUnderPoint(cursorPosition); } else { selectedCaptureWindow = window; } break; } } } if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) { capture.CaptureDetails.Title = selectedCaptureWindow.Text; capture.CaptureDetails.AddMetaData("windowtitle", selectedCaptureWindow.Text); if (captureMode == CaptureMode.Window) { // Here we want to capture the window which is under the mouse captureRect = selectedCaptureWindow.WindowRectangle; // As the ClientRectangle is not in Bitmap coordinates, we need to correct. captureRect.Offset(-capture.ScreenBounds.Location.X, -capture.ScreenBounds.Location.Y); } } Rectangle invalidateRectangle = Rectangle.Empty; if (mouseDown && (captureMode != CaptureMode.Window)) { int x1 = Math.Min(mX, lastPos.X); int x2 = Math.Max(mX, lastPos.X); int y1 = Math.Min(mY, lastPos.Y); int y2 = Math.Max(mY, lastPos.Y); x1 = Math.Min(x1, cursorPos.X); x2 = Math.Max(x2, cursorPos.X); y1 = Math.Min(y1, cursorPos.Y); y2 = Math.Max(y2, cursorPos.Y); // Safety correction x2 += 2; y2 += 2; // Here we correct for text-size // Calculate the size int textForWidth = Math.Max(Math.Abs(mX - cursorPos.X), Math.Abs(mX - lastPos.X)); int textForHeight = Math.Max(Math.Abs(mY - cursorPos.Y), Math.Abs(mY - lastPos.Y)); using (Font rulerFont = new Font(FontFamily.GenericSansSerif, 8)) { Size measureWidth = TextRenderer.MeasureText(textForWidth.ToString(), rulerFont); x1 -= measureWidth.Width + 15; Size measureHeight = TextRenderer.MeasureText(textForHeight.ToString(), rulerFont); y1 -= measureWidth.Height + 10; } invalidateRectangle = new Rectangle(x1, y1, x2 - x1, y2 - y1); Invalidate(invalidateRectangle); } else if (captureMode != CaptureMode.Window) { if (!isTerminalServerSession) { Rectangle allScreenBounds = WindowCapture.GetScreenBounds(); allScreenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(allScreenBounds.Location); if (verticalMove) { // Before invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, lastPos.Y - 2, this.Width + 2, 45); Invalidate(invalidateRectangle); // After invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, cursorPos.Y - 2, this.Width + 2, 45); Invalidate(invalidateRectangle); } if (horizontalMove) { // Before invalidateRectangle = GuiRectangle.GetGuiRectangle(lastPos.X - 2, allScreenBounds.Top, 75, this.Height + 2); Invalidate(invalidateRectangle); // After invalidateRectangle = GuiRectangle.GetGuiRectangle(cursorPos.X - 2, allScreenBounds.Top, 75, this.Height + 2); Invalidate(invalidateRectangle); } } } else { if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) { // Window changes, make new animation from current to target windowAnimator.ChangeDestination(captureRect, FramesForMillis(700)); } } // always animate the Window area through to the last frame, so we see the fade-in/out untill the end // Using a safety "offset" to make sure the text is invalidated too const int SAFETY_SIZE = 30; // Check if the if (isAnimating(windowAnimator)) { invalidateRectangle = windowAnimator.Current; invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE); Invalidate(invalidateRectangle); invalidateRectangle = windowAnimator.Next(); invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE); Invalidate(invalidateRectangle); // Check if this was the last of the windows animations in the normal region capture. if (captureMode != CaptureMode.Window && !isAnimating(windowAnimator)) { Invalidate(); } } if (zoomAnimator != null && (isAnimating(zoomAnimator) || captureMode != CaptureMode.Window)) { // Make sure we invalidate the old zoom area invalidateRectangle = zoomAnimator.Current; invalidateRectangle.Offset(lastPos); Invalidate(invalidateRectangle); // Only verify if we are really showing the zoom, not the outgoing animation if (conf.ZoomerEnabled && captureMode != CaptureMode.Window) { VerifyZoomAnimation(cursorPos, false); } // The following logic is not needed, next always returns the current if there are no frames left // but it makes more sense if we want to change something in the logic if (isAnimating(zoomAnimator)) { invalidateRectangle = zoomAnimator.Next(); } else { invalidateRectangle = zoomAnimator.Current; } invalidateRectangle.Offset(cursorPos); Invalidate(invalidateRectangle); } // Force update "now" Update(); }
protected override void Animate() { Rectangle invalidateRectangle; if (Down>=2) { // _mouseMovePos = FixMouseCoordinates(User32.GetCursorLocation());//返回更新鼠标位置。当前的坐标的点。 // _mouseMovePos = WindowCapture.GetLocationRelativeToScreenBounds(_mouseMovePos); // _captureRect = GuiRectangle.GetGuiRectangle(_mouseMovePos.X, _mouseMovePos.Y, _mX - _mouseMovePos.X, _mY - _mouseMovePos.Y); // MessageBox.Show("Ani"); // Update(); // MessageBox.Show("here"); _captureRect = GuiRectangle.GetGuiRectangle(_cX,_cY,width ,height); //MessageBox.Show("here"); invalidateRectangle = new Rectangle(0, 0, 1920, 1680); Invalidate(invalidateRectangle); Update(); return; } Point lastPos = _cursorPos; _cursorPos = _mouseMovePos;//使用一次之后cursor就开始记录上一次的坐标的位置。 if (_selectedCaptureWindow != null && lastPos.Equals(_cursorPos) && !isAnimating(_zoomAnimator) && !isAnimating(_windowAnimator))//添加后满足条件。 { return; } WindowDetails lastWindow = _selectedCaptureWindow; bool horizontalMove = false; bool verticalMove = false; if (lastPos.X != _cursorPos.X) { horizontalMove = true; } if (lastPos.Y != _cursorPos.Y) { verticalMove = true; } if (_captureMode == CaptureMode.Region && _mouseDown) { _captureRect = GuiRectangle.GetGuiRectangle(_cursorPos.X, _cursorPos.Y, _mX - _cursorPos.X, _mY - _cursorPos.Y); } // Iterate over the found windows and check if the current location is inside a window Point cursorPosition = Cursor.Position; _selectedCaptureWindow = null; lock (_windows) { foreach (WindowDetails window in _windows) { if (window.Contains(cursorPosition)) { // Only go over the children if we are in window mode if (CaptureMode.Window == _captureMode) { // _selectedCaptureWindow = window.FindChildUnderPoint(cursorPosition); } else { // _selectedCaptureWindow = window; not } break; } } } if (_selectedCaptureWindow != null && !_selectedCaptureWindow.Equals(lastWindow)) { //_capture.CaptureDetails.Title = _selectedCaptureWindow.Text; //_capture.CaptureDetails.AddMetaData("windowtitle", _selectedCaptureWindow.Text); if (_captureMode == CaptureMode.Window) { // Here we want to capture the window which is under the mouse // _captureRect = _selectedCaptureWindow.WindowRectangle; // As the ClientRectangle is not in Bitmap coordinates, we need to correct. // _captureRect.Offset(-_capture.ScreenBounds.Location.X, -_capture.ScreenBounds.Location.Y); } } //Rectangle invalidateRectangle; if (_mouseDown && (_captureMode != CaptureMode.Window)) { int x1 = Math.Min(_mX, lastPos.X); int x2 = Math.Max(_mX, lastPos.X); int y1 = Math.Min(_mY, lastPos.Y); int y2 = Math.Max(_mY, lastPos.Y); x1 = Math.Min(x1, _cursorPos.X); x2 = Math.Max(x2, _cursorPos.X); y1 = Math.Min(y1, _cursorPos.Y); y2 = Math.Max(y2, _cursorPos.Y); // int x1 = Math.Min(_mX, _cursorPos.X); // int x2 = Math.Max(_mX, _cursorPos.X); // int y1 = Math.Min(_mY, _cursorPos.Y); // int y2 = Math.Max(_mY, _cursorPos.Y); // Safety correction // x2 += 2; // y2 += 2; // Here we correct for text-size // Calculate the size int textForWidth = Math.Max(Math.Abs(_mX - _cursorPos.X), Math.Abs(_mX - lastPos.X)); int textForHeight = Math.Max(Math.Abs(_mY - _cursorPos.Y), Math.Abs(_mY - lastPos.Y)); using (Font rulerFont = new Font(FontFamily.GenericSansSerif, 8)) { // Size measureWidth = TextRenderer.MeasureText(textForWidth.ToString(CultureInfo.InvariantCulture), rulerFont); // x1 -= measureWidth.Width + 15; // Size measureHeight = TextRenderer.MeasureText(textForHeight.ToString(CultureInfo.InvariantCulture), rulerFont); // y1 -= measureHeight.Height + 10; } // invalidateRectangle = new Rectangle(0, 0, 400, 400); invalidateRectangle = new Rectangle(0, 0, 1920, 1600); Invalidate(invalidateRectangle); } else if (_captureMode != CaptureMode.Window) { if (!isTerminalServerSession) { // Rectangle allScreenBounds = WindowCapture.GetScreenBounds(); // allScreenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(allScreenBounds.Location); // if (verticalMove) { // Before // invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, lastPos.Y - 2, Width + 2, 45); // Invalidate(invalidateRectangle); // After // invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, _cursorPos.Y - 2, Width + 2, 45); // Invalidate(invalidateRectangle); } if (horizontalMove) { // Before // invalidateRectangle = GuiRectangle.GetGuiRectangle(lastPos.X - 2, allScreenBounds.Top, 75, Height + 2); // Invalidate(invalidateRectangle); // After // invalidateRectangle = GuiRectangle.GetGuiRectangle(_cursorPos.X - 2, allScreenBounds.Top, 75, Height + 2); // Invalidate(invalidateRectangle); } } } else { if (_selectedCaptureWindow != null && !_selectedCaptureWindow.Equals(lastWindow)) { // Window changes, make new animation from current to target // _windowAnimator.ChangeDestination(_captureRect, FramesForMillis(700)); } } // always animate the Window area through to the last frame, so we see the fade-in/out untill the end // Using a safety "offset" to make sure the text is invalidated too const int safetySize = 30; // Check if the if (isAnimating(_windowAnimator)) { // invalidateRectangle = _windowAnimator.Current; // invalidateRectangle.Inflate(safetySize, safetySize); // Invalidate(invalidateRectangle); // invalidateRectangle = _windowAnimator.Next(); // invalidateRectangle.Inflate(safetySize, safetySize); // Invalidate(invalidateRectangle); // Check if this was the last of the windows animations in the normal region capture. // if (_captureMode != CaptureMode.Window && !isAnimating(_windowAnimator)) // { // Invalidate(); // } } if (_zoomAnimator != null && (isAnimating(_zoomAnimator) || _captureMode != CaptureMode.Window)) { // Make sure we invalidate the old zoom area // invalidateRectangle = _zoomAnimator.Current; // invalidateRectangle.Offset(lastPos); // Invalidate(invalidateRectangle); // Only verify if we are really showing the zoom, not the outgoing animation if (Conf.ZoomerEnabled && _captureMode != CaptureMode.Window) { // VerifyZoomAnimation(_cursorPos, false); } // The following logic is not needed, next always returns the current if there are no frames left // but it makes more sense if we want to change something in the logic if (isAnimating(_zoomAnimator)) { // invalidateRectangle = _zoomAnimator.Next(); } else { // invalidateRectangle = _zoomAnimator.Current; } // invalidateRectangle.Offset(_cursorPos); // Invalidate(invalidateRectangle); } // Force update "now" Update(); }
protected override void Animate() { Rectangle invalidateRectangle; if (Down >= 2) { // _mouseMovePos = FixMouseCoordinates(User32.GetCursorLocation());//返回更新鼠标位置。当前的坐标的点。 // _mouseMovePos = WindowCapture.GetLocationRelativeToScreenBounds(_mouseMovePos); // _captureRect = GuiRectangle.GetGuiRectangle(_mouseMovePos.X, _mouseMovePos.Y, _mX - _mouseMovePos.X, _mY - _mouseMovePos.Y); // MessageBox.Show("Ani"); // Update(); // MessageBox.Show("here"); _captureRect = GuiRectangle.GetGuiRectangle(_cX, _cY, width, height); //MessageBox.Show("here"); invalidateRectangle = new Rectangle(0, 0, 1920, 1680); Invalidate(invalidateRectangle); Update(); return; } Point lastPos = _cursorPos; _cursorPos = _mouseMovePos; //使用一次之后cursor就开始记录上一次的坐标的位置。 if (_selectedCaptureWindow != null && lastPos.Equals(_cursorPos) && !isAnimating(_zoomAnimator) && !isAnimating(_windowAnimator)) //添加后满足条件。 { return; } WindowDetails lastWindow = _selectedCaptureWindow; bool horizontalMove = false; bool verticalMove = false; if (lastPos.X != _cursorPos.X) { horizontalMove = true; } if (lastPos.Y != _cursorPos.Y) { verticalMove = true; } if (_captureMode == CaptureMode.Region && _mouseDown) { _captureRect = GuiRectangle.GetGuiRectangle(_cursorPos.X, _cursorPos.Y, _mX - _cursorPos.X, _mY - _cursorPos.Y); } // Iterate over the found windows and check if the current location is inside a window Point cursorPosition = Cursor.Position; _selectedCaptureWindow = null; lock (_windows) { foreach (WindowDetails window in _windows) { if (window.Contains(cursorPosition)) { // Only go over the children if we are in window mode if (CaptureMode.Window == _captureMode) { // _selectedCaptureWindow = window.FindChildUnderPoint(cursorPosition); } else { // _selectedCaptureWindow = window; not } break; } } } if (_selectedCaptureWindow != null && !_selectedCaptureWindow.Equals(lastWindow)) { //_capture.CaptureDetails.Title = _selectedCaptureWindow.Text; //_capture.CaptureDetails.AddMetaData("windowtitle", _selectedCaptureWindow.Text); if (_captureMode == CaptureMode.Window) { // Here we want to capture the window which is under the mouse // _captureRect = _selectedCaptureWindow.WindowRectangle; // As the ClientRectangle is not in Bitmap coordinates, we need to correct. // _captureRect.Offset(-_capture.ScreenBounds.Location.X, -_capture.ScreenBounds.Location.Y); } } //Rectangle invalidateRectangle; if (_mouseDown && (_captureMode != CaptureMode.Window)) { int x1 = Math.Min(_mX, lastPos.X); int x2 = Math.Max(_mX, lastPos.X); int y1 = Math.Min(_mY, lastPos.Y); int y2 = Math.Max(_mY, lastPos.Y); x1 = Math.Min(x1, _cursorPos.X); x2 = Math.Max(x2, _cursorPos.X); y1 = Math.Min(y1, _cursorPos.Y); y2 = Math.Max(y2, _cursorPos.Y); // int x1 = Math.Min(_mX, _cursorPos.X); // int x2 = Math.Max(_mX, _cursorPos.X); // int y1 = Math.Min(_mY, _cursorPos.Y); // int y2 = Math.Max(_mY, _cursorPos.Y); // Safety correction // x2 += 2; // y2 += 2; // Here we correct for text-size // Calculate the size int textForWidth = Math.Max(Math.Abs(_mX - _cursorPos.X), Math.Abs(_mX - lastPos.X)); int textForHeight = Math.Max(Math.Abs(_mY - _cursorPos.Y), Math.Abs(_mY - lastPos.Y)); using (Font rulerFont = new Font(FontFamily.GenericSansSerif, 8)) { // Size measureWidth = TextRenderer.MeasureText(textForWidth.ToString(CultureInfo.InvariantCulture), rulerFont); // x1 -= measureWidth.Width + 15; // Size measureHeight = TextRenderer.MeasureText(textForHeight.ToString(CultureInfo.InvariantCulture), rulerFont); // y1 -= measureHeight.Height + 10; } // invalidateRectangle = new Rectangle(0, 0, 400, 400); invalidateRectangle = new Rectangle(0, 0, 1920, 1600); Invalidate(invalidateRectangle); } else if (_captureMode != CaptureMode.Window) { if (!isTerminalServerSession) { // Rectangle allScreenBounds = WindowCapture.GetScreenBounds(); // allScreenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(allScreenBounds.Location); // if (verticalMove) { // Before // invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, lastPos.Y - 2, Width + 2, 45); // Invalidate(invalidateRectangle); // After // invalidateRectangle = GuiRectangle.GetGuiRectangle(allScreenBounds.Left, _cursorPos.Y - 2, Width + 2, 45); // Invalidate(invalidateRectangle); } if (horizontalMove) { // Before // invalidateRectangle = GuiRectangle.GetGuiRectangle(lastPos.X - 2, allScreenBounds.Top, 75, Height + 2); // Invalidate(invalidateRectangle); // After // invalidateRectangle = GuiRectangle.GetGuiRectangle(_cursorPos.X - 2, allScreenBounds.Top, 75, Height + 2); // Invalidate(invalidateRectangle); } } } else { if (_selectedCaptureWindow != null && !_selectedCaptureWindow.Equals(lastWindow)) { // Window changes, make new animation from current to target // _windowAnimator.ChangeDestination(_captureRect, FramesForMillis(700)); } } // always animate the Window area through to the last frame, so we see the fade-in/out untill the end // Using a safety "offset" to make sure the text is invalidated too const int safetySize = 30; // Check if the if (isAnimating(_windowAnimator)) { // invalidateRectangle = _windowAnimator.Current; // invalidateRectangle.Inflate(safetySize, safetySize); // Invalidate(invalidateRectangle); // invalidateRectangle = _windowAnimator.Next(); // invalidateRectangle.Inflate(safetySize, safetySize); // Invalidate(invalidateRectangle); // Check if this was the last of the windows animations in the normal region capture. // if (_captureMode != CaptureMode.Window && !isAnimating(_windowAnimator)) // { // Invalidate(); // } } if (_zoomAnimator != null && (isAnimating(_zoomAnimator) || _captureMode != CaptureMode.Window)) { // Make sure we invalidate the old zoom area // invalidateRectangle = _zoomAnimator.Current; // invalidateRectangle.Offset(lastPos); // Invalidate(invalidateRectangle); // Only verify if we are really showing the zoom, not the outgoing animation if (Conf.ZoomerEnabled && _captureMode != CaptureMode.Window) { // VerifyZoomAnimation(_cursorPos, false); } // The following logic is not needed, next always returns the current if there are no frames left // but it makes more sense if we want to change something in the logic if (isAnimating(_zoomAnimator)) { // invalidateRectangle = _zoomAnimator.Next(); } else { // invalidateRectangle = _zoomAnimator.Current; } // invalidateRectangle.Offset(_cursorPos); // Invalidate(invalidateRectangle); } // Force update "now" Update(); }
void PictureBoxMouseMove(object sender, MouseEventArgs e) { Point lastPos = new Point(cursorPos.X, cursorPos.Y); cursorPos = WindowCapture.GetCursorLocation(); // Make sure the mouse coordinates are fixed, when pressing shift cursorPos = FixMouseCoordinates(cursorPos); // As the cursorPos is not in Bitmap coordinates, we need to correct. cursorPos.Offset(-capture.ScreenBounds.Location.X, -capture.ScreenBounds.Location.Y); Rectangle lastCaptureRect = new Rectangle(captureRect.Location, captureRect.Size); WindowDetails lastWindow = selectedCaptureWindow; bool horizontalMove = false; bool verticalMove = false; if (lastPos.X != cursorPos.X) { horizontalMove = true; } if (lastPos.Y != cursorPos.Y) { verticalMove = true; } if (captureMode == CaptureMode.Region && mouseDown) { captureRect = GuiRectangle.GetGuiRectangle(cursorPos.X, cursorPos.Y, mX - cursorPos.X, mY - cursorPos.Y); } // Iterate over the found windows and check if the current location is inside a window Point cursorPosition = Cursor.Position; selectedCaptureWindow = null; lock (windows) { foreach (WindowDetails window in windows) { if (window.Contains(cursorPosition)) { // Only go over the children if we are in window mode if (CaptureMode.Window == captureMode) { selectedCaptureWindow = window.FindChildUnderPoint(cursorPosition); } else { selectedCaptureWindow = window; } break; } } } if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) { capture.CaptureDetails.Title = selectedCaptureWindow.Text; capture.CaptureDetails.AddMetaData("windowtitle", selectedCaptureWindow.Text); if (captureMode == CaptureMode.Window) { // Here we want to capture the window which is under the mouse captureRect = selectedCaptureWindow.WindowRectangle; // As the ClientRectangle is not in Bitmap coordinates, we need to correct. captureRect.Offset(-capture.ScreenBounds.Location.X, -capture.ScreenBounds.Location.Y); } } if (mouseDown && (CaptureMode.Window != captureMode)) { int x1 = Math.Min(mX, lastPos.X); int x2 = Math.Max(mX, lastPos.X); int y1 = Math.Min(mY, lastPos.Y); int y2 = Math.Max(mY, lastPos.Y); x1 = Math.Min(x1, cursorPos.X); x2 = Math.Max(x2, cursorPos.X); y1 = Math.Min(y1, cursorPos.Y); y2 = Math.Max(y2, cursorPos.Y); // Safety correction x2 += 2; y2 += 2; // Here we correct for text-size // Calculate the size int textForWidth = Math.Max(Math.Abs(mX - cursorPos.X), Math.Abs(mX - lastPos.X)); int textForHeight = Math.Max(Math.Abs(mY - cursorPos.Y), Math.Abs(mY - lastPos.Y)); using (Font rulerFont = new Font(FontFamily.GenericSansSerif, 8)) { Size measureWidth = TextRenderer.MeasureText(textForWidth.ToString(), rulerFont); x1 -= measureWidth.Width + 15; Size measureHeight = TextRenderer.MeasureText(textForHeight.ToString(), rulerFont); y1 -= measureWidth.Height + 10; } Rectangle invalidateRectangle = new Rectangle(x1, y1, x2 - x1, y2 - y1); pictureBox.Invalidate(invalidateRectangle); } else { if (captureMode == CaptureMode.Window) { if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) { // Using a 50 Pixel offset to the left, top, to make sure the text is invalidated too const int SAFETY_SIZE = 50; Rectangle invalidateRectangle = new Rectangle(lastCaptureRect.Location, lastCaptureRect.Size); invalidateRectangle.X -= SAFETY_SIZE / 2; invalidateRectangle.Y -= SAFETY_SIZE / 2; invalidateRectangle.Width += SAFETY_SIZE; invalidateRectangle.Height += SAFETY_SIZE; pictureBox.Invalidate(invalidateRectangle); invalidateRectangle = new Rectangle(captureRect.Location, captureRect.Size); invalidateRectangle.X -= SAFETY_SIZE / 2; invalidateRectangle.Y -= SAFETY_SIZE / 2; invalidateRectangle.Width += SAFETY_SIZE; invalidateRectangle.Height += SAFETY_SIZE; pictureBox.Invalidate(invalidateRectangle); } } else { if (!conf.OptimizeForRDP) { if (verticalMove) { Rectangle before = GuiRectangle.GetGuiRectangle(0, lastPos.Y - 2, this.Width + 2, 45); Rectangle after = GuiRectangle.GetGuiRectangle(0, cursorPos.Y - 2, this.Width + 2, 45); pictureBox.Invalidate(before); pictureBox.Invalidate(after); } if (horizontalMove) { Rectangle before = GuiRectangle.GetGuiRectangle(lastPos.X - 2, 0, 75, this.Height + 2); Rectangle after = GuiRectangle.GetGuiRectangle(cursorPos.X - 2, 0, 75, this.Height + 2); pictureBox.Invalidate(before); pictureBox.Invalidate(after); } } } } }