title-bar fix

This commit is contained in:
stax76
2024-08-10 11:19:23 +02:00
parent 9d30acaba6
commit 07749cb2cc
2 changed files with 13 additions and 9 deletions

View File

@@ -27,7 +27,7 @@ public static class WinApiHelp
}
}
public static void AdjustWindowRect(IntPtr hwnd, ref RECT rc, int dpi)
public static void AdjustWindowRectangle(IntPtr hwnd, ref RECT rc, int dpi)
{
uint style = (uint)GetWindowLongPtr(hwnd, -16); // GWL_STYLE
uint styleEx = (uint)GetWindowLongPtr(hwnd, -20); // GWL_EXSTYLE
@@ -35,13 +35,13 @@ public static class WinApiHelp
if (Environment.OSVersion.Version >= WindowsTen1607)
AdjustWindowRectExForDpi(ref rc, style, false, styleEx, (uint)dpi);
else
Native.WinApi.AdjustWindowRect(ref rc, style, false);
AdjustWindowRect(ref rc, style, false);
}
public static void AddWindowBorders(IntPtr hwnd, ref RECT rc, int dpi, bool changeTop)
{
RECT win = rc;
AdjustWindowRect(hwnd, ref rc, dpi);
AdjustWindowRectangle(hwnd, ref rc, dpi);
if (changeTop)
{
@@ -64,7 +64,7 @@ public static class WinApiHelp
public static int GetTitleBarHeight(IntPtr hwnd, int dpi)
{
RECT rect = new RECT();
AdjustWindowRect(hwnd, ref rect, dpi);
AdjustWindowRectangle(hwnd, ref rect, dpi);
return -rect.Top;
}