private void MailboxViewerForm_Load(object sender, System.EventArgs e) { closeSessionToolStripMenuItem.Enabled = false; windowToolStripMenuItem.Visible = false; // Change window title Text = Util.GenerateWindowTitle("Mailbox Viewer"); }
private void MailboxViewerForm_Load(object sender, EventArgs e) { Icon = Properties.Resources.DefaultIcon; closeSessionToolStripMenuItem.Enabled = false; windowToolStripMenuItem.Visible = false; // Change window title Text = Util.GenerateWindowTitle("Mailbox Viewer"); // Restore window location, size and state. var savedBounds = Properties.Settings.Default.MailboxViewerFormBounds; var savedWindowState = Properties.Settings.Default.MailboxViewerFormWindowState; if (savedWindowState == FormWindowState.Minimized) { // We should not restore window location, size and state. savedBounds = new Rectangle(0, 0, 0, 0); savedWindowState = FormWindowState.Normal; } else if (savedWindowState == FormWindowState.Maximized) { // We should not restore window size. savedBounds = new Rectangle(new Point(savedBounds.Location.X + 8, savedBounds.Y + 8), new Size(Width, Height)); } if (!savedBounds.IsEmpty) { // We should not restore window size and location if it is out of screens. foreach (Screen screen in Screen.AllScreens) { if (screen.WorkingArea.Contains(savedBounds)) { Bounds = savedBounds; break; } } } WindowState = savedWindowState; }