Skip to content

Commit

Permalink
Merge pull request #1927 from MahApps/1924-FlowDirection-RightToLeft-…
Browse files Browse the repository at this point in the history
…Window-Max-fix

fix using window FlowDirection="RightToLeft"
  • Loading branch information
punker76 committed May 20, 2015
2 parents 891942e + 693361c commit 688c4ec
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions MahApps.Metro/Microsoft.Windows.Shell/WindowChromeWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,14 +1134,21 @@ private void _ClearRoundingRegion()
NativeMethods.SetWindowRgn(_hwnd, IntPtr.Zero, NativeMethods.IsWindowVisible(_hwnd));
}

private static RECT _GetClientRectRelativeToWindowRect(IntPtr hWnd)
private RECT _GetClientRectRelativeToWindowRect(IntPtr hWnd)
{
RECT windowRect = NativeMethods.GetWindowRect(hWnd);
RECT clientRect = NativeMethods.GetClientRect(hWnd);

POINT test = new POINT() { x = 0, y = 0 };
NativeMethods.ClientToScreen(hWnd, ref test);
clientRect.Offset(test.x - windowRect.Left, test.y - windowRect.Top);
if (_window.FlowDirection == FlowDirection.RightToLeft)
{
clientRect.Offset(windowRect.Right - test.x, test.y - windowRect.Top);
}
else
{
clientRect.Offset(test.x - windowRect.Left, test.y - windowRect.Top);
}
return clientRect;
}

Expand Down

0 comments on commit 688c4ec

Please sign in to comment.