private static int GetEdge(RECT rc)
        {
            int uEdge;

            if (rc.Top == rc.Left && rc.Bottom > rc.Right)
            {
                uEdge = (int)AbEdge.AbeLeft;
            }
            else if (rc.Top == rc.Left && rc.Bottom < rc.Right)
            {
                uEdge = (int)AbEdge.AbeTop;
            }
            else if (rc.Top > rc.Left)
            {
                uEdge = (int)AbEdge.AbeBottom;
            }
            else
            {
                uEdge = (int)AbEdge.AbeRight;
            }
            return(uEdge);
        }
 internal static void FindMaximumSingleMonitorRectangle(RECT windowRect, out RECT screenSubRect, out RECT monitorRect)
 {
     var rects = new List<RECT>();
     NativeMethods.NativeMethods.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, (IntPtr hMonitor, IntPtr hdcMonitor, ref RECT rect, IntPtr lpData) =>
     {
         Monitorinfo monitorInfo = new Monitorinfo {CbSize = (uint) Marshal.SizeOf(typeof (Monitorinfo))};
         NativeMethods.NativeMethods.GetMonitorInfo(hMonitor, ref monitorInfo);
         rects.Add(monitorInfo.RcWork);
         return true;
     }, IntPtr.Zero);
     var num1 = 0L;
     screenSubRect = new RECT()
     {
         Left = 0,
         Right = 0,
         Top = 0,
         Bottom = 0
     };
     monitorRect = new RECT()
     {
         Left = 0,
         Right = 0,
         Top = 0,
         Bottom = 0
     };
     foreach (RECT rect in rects)
     {
         var lprcSrc1 = rect;
         RECT lprcDst;
         NativeMethods.NativeMethods.IntersectRect(out lprcDst, ref lprcSrc1, ref windowRect);
         var num2 = (long)(lprcDst.Width * lprcDst.Height);
         if (num2 > num1)
         {
             screenSubRect = lprcDst;
             monitorRect = rect;
             num1 = num2;
         }
     }
 }
 private void WmWindowPosChanged(IntPtr hWnd, IntPtr lParam)
 {
     try
     {
         var windowpos       = (Windowpos)Marshal.PtrToStructure(lParam, typeof(Windowpos));
         var windowPlacement = NativeMethods.GetWindowPlacement(hWnd);
         var currentBounds   = new RECT(windowpos.x, windowpos.y, windowpos.x + windowpos.cx,
                                        windowpos.y + windowpos.cy);
         if (((int)windowpos.flags & 1) != 1)
         {
             UpdateClipRegion(hWnd, windowPlacement, ClipRegionChangeType.FromSize, currentBounds);
         }
         else if (((int)windowpos.flags & 2) != 2)
         {
             UpdateClipRegion(hWnd, windowPlacement, ClipRegionChangeType.FromPosition, currentBounds);
         }
         OnWindowPosChanged(hWnd, windowPlacement.showCmd, windowPlacement.rcNormalPosition.ToInt32Rect());
         UpdateGlowWindowPositions(true);
         UpdateZOrderOfThisAndOwner();
     }
     catch (Win32Exception)
     {
     }
 }
 private void UpdateClipRegion(IntPtr hWnd, Windowplacement placement, ClipRegionChangeType changeType,
                               RECT currentBounds)
 {
     UpdateClipRegionCore(hWnd, placement.showCmd, changeType, currentBounds.ToInt32Rect());
     _lastWindowPlacement = placement.showCmd;
 }
 private void WmWindowPosChanged(IntPtr hWnd, IntPtr lParam)
 {
     try
     {
         var windowpos = (Windowpos) Marshal.PtrToStructure(lParam, typeof (Windowpos));
         var windowPlacement = NativeMethods.GetWindowPlacement(hWnd);
         var currentBounds = new RECT(windowpos.x, windowpos.y, windowpos.x + windowpos.cx,
             windowpos.y + windowpos.cy);
         if (((int) windowpos.flags & 1) != 1)
             UpdateClipRegion(hWnd, windowPlacement, ClipRegionChangeType.FromSize, currentBounds);
         else if (((int) windowpos.flags & 2) != 2)
             UpdateClipRegion(hWnd, windowPlacement, ClipRegionChangeType.FromPosition, currentBounds);
         OnWindowPosChanged(hWnd, windowPlacement.showCmd, windowPlacement.rcNormalPosition.ToInt32Rect());
         UpdateGlowWindowPositions(true);
         UpdateZOrderOfThisAndOwner();
     }
     catch (Win32Exception)
     {
     }
 }
 private void UpdateClipRegion(IntPtr hWnd, Windowplacement placement, ClipRegionChangeType changeType,
     RECT currentBounds)
 {
     UpdateClipRegionCore(hWnd, placement.showCmd, changeType, currentBounds.ToInt32Rect());
     _lastWindowPlacement = placement.showCmd;
 }
 private static int GetEdge(RECT rc)
 {
     int uEdge;
     if (rc.Top == rc.Left && rc.Bottom > rc.Right)
         uEdge = (int) AbEdge.AbeLeft;
     else if (rc.Top == rc.Left && rc.Bottom < rc.Right)
         uEdge = (int) AbEdge.AbeTop;
     else if (rc.Top > rc.Left)
         uEdge = (int) AbEdge.AbeBottom;
     else
         uEdge = (int) AbEdge.AbeRight;
     return uEdge;
 }