diff --git a/ShareX.ScreenCaptureLib/Shapes/Tool/CutOutTool.cs b/ShareX.ScreenCaptureLib/Shapes/Tool/CutOutTool.cs index ef2520ff9..76a6277c5 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Tool/CutOutTool.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Tool/CutOutTool.cs @@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License #endregion License Information (GPL v3) using ShareX.HelpersLib; +using System; using System.Drawing; using System.Windows.Forms; @@ -122,11 +123,11 @@ public override void OnDraw(Graphics g) { if (IsHorizontalTrim) { - g.FillRectangle(selectionHighlightBrush, new RectangleF(Rectangle.X, g.ClipBounds.Y, Rectangle.Width, g.ClipBounds.Height)); + g.FillRectangle(selectionHighlightBrush, new RectangleF(Rectangle.X, Math.Max(g.ClipBounds.Y, Manager.Form.CanvasRectangle.Y), Rectangle.Width, Math.Min(g.ClipBounds.Height, Manager.Form.CanvasRectangle.Height))); } else if (IsVerticalTrim) { - g.FillRectangle(selectionHighlightBrush, new RectangleF(g.ClipBounds.X, Rectangle.Y, g.ClipBounds.Width, Rectangle.Height)); + g.FillRectangle(selectionHighlightBrush, new RectangleF(Math.Max(g.ClipBounds.X, Manager.Form.CanvasRectangle.X), Rectangle.Y, Math.Min(g.ClipBounds.Width, Manager.Form.CanvasRectangle.Width), Rectangle.Height)); } } }