private void exitToolStripMenuItem_Click(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Normal) { cfgWrite("Height", this.Height.ToString()); cfgWrite("Width", this.Width.ToString()); cfgWrite("isMaximized", "False"); } else { cfgWrite("Height", NormalHeight.ToString()); cfgWrite("Width", NormalWidth.ToString()); cfgWrite("isMaximized", "True"); } cfgWrite("StatusBar", MainstatusStrip.Visible.ToString()); cfgWrite("MenuBar", MainmenuStrip.Visible.ToString()); if (isEditorMode) { if (MainrichTextBox.Text != "") { DialogResult Result = MessageBox.Show("是否保存", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (Result == DialogResult.Yes) { saveToolStripMenuItem_Click(sender, e); } } } Environment.Exit(0); }
private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (this.WindowState == WindowState.Normal) { cfgWrite("Height", this.Height.ToString()); cfgWrite("Width", this.Width.ToString()); cfgWrite("Maximized", "False"); } else { cfgWrite("Height", NormalHeigth.ToString()); cfgWrite("Width", NormalWidth.ToString()); cfgWrite("Maximized", "True"); } cfgWrite("Title", this.Title); Environment.Exit(0); }