/// <summary> /// Converts client size rectangle to window rectangle, according to window styles. /// </summary> /// <param name="clientRectangle">Client area bounding box.</param> /// <param name="windowStyle">Style of window to compute.</param> /// <param name="extendedWindowStyle">Extended style of window to compute.</param> public static NRectangle ConvertClientToWindowRect(NRectangle clientRectangle, long windowStyle, long extendedWindowStyle) { NRectangle tmp = clientRectangle; if (AdjustWindowRectEx(ref tmp, windowStyle, false, extendedWindowStyle)) { return tmp; } else { #if DEBUG throw new InvalidOperationException("Failed to convert client rectangle to window rectangle"); #else return clientRectangle; #endif } }
/// <summary> /// Converts client size rectangle to window rectangle, according to window styles. /// </summary> /// <param name="clientRectangle">Client area bounding box.</param> /// <param name="windowStyle">Style of window to compute.</param> /// <param name="extendedWindowStyle">Extended style of window to compute.</param> public static NRectangle ConvertClientToWindowRect(NRectangle clientRectangle, long windowStyle, long extendedWindowStyle) { NRectangle tmp = clientRectangle; if (AdjustWindowRectEx(ref tmp, windowStyle, false, extendedWindowStyle)) { return(tmp); } else { #if DEBUG throw new InvalidOperationException("Failed to convert client rectangle to window rectangle"); #else return(clientRectangle); #endif } }
public static extern bool GetClientRect(IntPtr handle, out NRectangle rect);
private static extern bool AdjustWindowRectEx(ref NRectangle clientToWindowRect, long windowStyle, bool hasMenu, long extendedWindowStyle);
public static extern bool GetWindowRect(IntPtr handle, out NRectangle rect);