public static void DisableButtons(this Window window, WindowButtons buttons) { IntPtr handle = new System.Windows.Interop.WindowInteropHelper(window).Handle; int currentStyle = GetWindowLong(handle, GWL_STYLE); if (buttons.HasFlag(WindowButtons.Maximize)) { currentStyle &= ~WS_MAXIMIZEBOX; } if (buttons.HasFlag(WindowButtons.Minimize)) { currentStyle &= ~WS_MINIMIZEBOX; } SetWindowLong(handle, GWL_STYLE, currentStyle); }
public Window(int x, int y, int width, int height, WindowButtons buttons = WindowButtons.None) { Area = new Rectangle(x, y, width, height); if (buttons.HasFlag(WindowButtons.Close)) { _btn_Close = new WindowButton(0, 0); } }