示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }