fixed #2192: Instead of all screen bounds, instead use intersected screen bounds when cropping outside area

This commit is contained in:
Jaex 2019-03-21 00:08:08 +03:00
parent 29a8572f68
commit 3f10f9ec49

View file

@ -27,6 +27,7 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Linq;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
@ -43,7 +44,8 @@ public Image CaptureWindowTransparent(IntPtr handle)
if (CaptureShadow && !NativeMethods.IsZoomed(handle) && NativeMethods.IsDWMEnabled()) if (CaptureShadow && !NativeMethods.IsZoomed(handle) && NativeMethods.IsDWMEnabled())
{ {
rect.Inflate(ShadowOffset, ShadowOffset); rect.Inflate(ShadowOffset, ShadowOffset);
rect.Intersect(CaptureHelpers.GetScreenBounds()); Rectangle intersectBounds = Screen.AllScreens.Select(x => x.Bounds).Where(x => x.IntersectsWith(rect)).Combine();
rect.Intersect(intersectBounds);
} }
Bitmap whiteBackground = null, blackBackground = null, whiteBackground2 = null; Bitmap whiteBackground = null, blackBackground = null, whiteBackground2 = null;