Exemplo n.º 1
0
        /// <summary>
        /// Returns what the window size is
        /// </summary>
        /// <returns>The state (minimized, maximized, etc..) of the window</returns>
        public WindowSizeState GetWindowSizeState()
        {
            InteropAndHelpers.WINDOWPLACEMENT placement = new InteropAndHelpers.WINDOWPLACEMENT();
            InteropAndHelpers.GetWindowPlacement(this.Hwnd, out placement);

            switch (placement.ShowCmd)
            {
            case InteropAndHelpers.ShowWindowCommands.Normal:
                return(WindowSizeState.Normal);

            case InteropAndHelpers.ShowWindowCommands.Minimize:
            case InteropAndHelpers.ShowWindowCommands.ShowMinimized:
                return(WindowSizeState.Minimized);

            case InteropAndHelpers.ShowWindowCommands.Maximize:     // No need for ShowMaximized here since its also of value 3
                return(WindowSizeState.Maximized);

            default:
                // throw new Exception("Don't know how to handle window state = " + placement.ShowCmd);
                return(WindowSizeState.Unknown);
            }
        }
Exemplo n.º 2
0
        public WindowSizeState GetWindowSizeState()
        {
            InteropAndHelpers.WINDOWPLACEMENT placement = new InteropAndHelpers.WINDOWPLACEMENT();
            InteropAndHelpers.GetWindowPlacement(this.Hwnd,out placement);

            switch (placement.ShowCmd)
            {
                case InteropAndHelpers.ShowWindowCommands.Normal:
                    return WindowSizeState.Normal;
                case InteropAndHelpers.ShowWindowCommands.Minimize:
                case InteropAndHelpers.ShowWindowCommands.ShowMinimized:
                    return WindowSizeState.Minimized;
                case InteropAndHelpers.ShowWindowCommands.Maximize: // No need for ShowMaximized here since its also of value 3
                    return WindowSizeState.Maximized;
                default:
                    // throw new Exception("Don't know how to handle window state = " + placement.ShowCmd);
                    return WindowSizeState.Unknown;
            }
        }