public void Restore(Form targetForm) { targetForm.WindowState = FormWindowState.Normal; targetForm.FormBorderStyle = FormBorderStyle.FixedSingle; // targetForm.TopMost = topMost; // targetForm.Bounds = bounds; IsMaximized = false; var m = orginalMode; DisplaySettings.ChangeDisplaySettings(ref m, 0); }
public void Maximize(Form targetForm) { if (!IsMaximized) { var m = Settings.GetDevmodeFor(0, 1024, 768); DisplaySettings.ChangeDisplaySettings(ref m, 0); IsMaximized = true; Save(targetForm); targetForm.WindowState = FormWindowState.Maximized; targetForm.FormBorderStyle = FormBorderStyle.None; targetForm.TopMost = true; WinApi.SetWinFullScreen(targetForm.Handle); } targetForm.TopMost = false; }
public FormState() { Settings = new DisplaySettings(); orginalMode = Settings.GetCurrentSettings(0); }