Fix crop image in multi monitor

This commit is contained in:
Jaex 2017-05-23 17:28:56 +03:00
parent 714cadeae2
commit 84d8997cfd
2 changed files with 5 additions and 4 deletions

View file

@ -24,7 +24,6 @@
#endregion License Information (GPL v3)
using System.Drawing;
using ShareX.HelpersLib;
namespace ShareX.ScreenCaptureLib
{

View file

@ -1248,11 +1248,13 @@ public void CropArea(Rectangle rect)
public Image CropImage(Rectangle rect, bool onlyIfSizeDifferent = false)
{
rect.X -= form.ImageRectangle.X;
rect.Y -= form.ImageRectangle.Y;
rect = CaptureHelpers.ScreenToClient(rect);
Point offset = CaptureHelpers.ScreenToClient(form.ImageRectangle.Location);
rect.X -= offset.X;
rect.Y -= offset.Y;
rect.Intersect(new Rectangle(0, 0, form.Image.Width, form.Image.Height));
if (rect.IsValid() && (!onlyIfSizeDifferent || rect.Size != form.Image.Size))