コード例 #1
0
ファイル: WindowState.cs プロジェクト: noscripter/ShareX
        public void GetFormState(Form form)
        {
            WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
            wp.length = Marshal.SizeOf(wp);

            if (NativeMethods.GetWindowPlacement(form.Handle, ref wp))
            {
                Location = wp.rcNormalPosition.Location;
                Size = wp.rcNormalPosition.Size;
                IsMaximized = wp.showCmd == WindowShowStyle.Maximize;
            }
        }
コード例 #2
0
        public static void RestoreWindow(IntPtr handle)
        {
            WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
            wp.length = Marshal.SizeOf(wp);
            GetWindowPlacement(handle, ref wp);

            if (wp.flags == (int)WindowPlacementFlags.WPF_RESTORETOMAXIMIZED)
            {
                wp.showCmd = WindowShowStyle.ShowMaximized;
            }
            else
            {
                wp.showCmd = WindowShowStyle.Restore;
            }

            SetWindowPlacement(handle, ref wp);
        }
コード例 #3
0
 public static bool IsWindowMaximized(IntPtr handle)
 {
     WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
     wp.length = Marshal.SizeOf(wp);
     GetWindowPlacement(handle, ref wp);
     return wp.showCmd == WindowShowStyle.Maximize;
 }
コード例 #4
0
ファイル: NativeMethods.cs プロジェクト: qimingnan/ShareX
 public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl);