/// <summary> /// Get window border height of the top border. /// </summary> /// <param name="window">HWND handle of the window to get the border of.</param> /// <returns>The height of the window's top border in pixels.</returns> private int GetWindowYBorder(IntPtr window) { Native.RECT clientRect = new Native.RECT(); Native.RECT windowRect = new Native.RECT(); Native.GetClientRect(window, out clientRect); Native.GetWindowRect(window, out windowRect); return(((windowRect.Bottom - windowRect.Top) - clientRect.Bottom) / 2); }
/// <summary> /// Get window border width on left or right. /// </summary> /// <param name="window">HWND handle of the window to get the border of.</param> /// <returns>The width of the window's left or right border in pixels.</returns> private int GetWindowXBorder(IntPtr window) { Native.RECT clientRect = new Native.RECT(); Native.RECT windowRect = new Native.RECT(); Native.GetClientRect(window, out clientRect); Native.GetWindowRect(window, out windowRect); return(((windowRect.Right - windowRect.Left) - clientRect.Right) / 2); }