private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //Synchronize manual associations first. frmSettings1.FormText = this.Text + '.'; frmSettings1.FormSize = this.Size; frmSettings1.Save(); }
/// <summary> /// Handles the Click event of the btnOk control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnOk_Click(object sender, System.EventArgs e) { this.DialogResult = DialogResult.OK; //保存界面设置值 formSettings.Save(); Close(); }
// On "Stop" button click private void stopButton_Click(object sender, EventArgs e) { StopCameras(); startButton.Enabled = true; stopButton.Enabled = false; parentFormSettings.Save(); this.Dispose(); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); if (DialogResult == DialogResult.Cancel) { return; // is canceling } if (!m_formSettings.Settings.HasChanges) { return; // nothing to do } StringBuilder _sb = new StringBuilder(); foreach (ISetting _setting in m_formSettings.Settings) { if (!_setting.HasChanged) { continue; } _sb.Append(" - "); _sb.Append(_setting.ToString()); _sb.Append("\n"); } DialogResult _result = MessageBox.Show("Save changes?\n\n" + _sb, Text, MessageBoxButtons.YesNoCancel); switch (_result) { case DialogResult.Yes: m_formSettings.Save(); break; case DialogResult.No: break; case DialogResult.Cancel: e.Cancel = true; break; } }
private void btnOK_Click(object sender, EventArgs e) { if (!NetworkInterface.GetIsNetworkAvailable()) { MessageBox.Show(I18n.L.T("NetworkDisconnected"), "Waveface", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult = DialogResult.None; if ((txtUserName.Text.Trim() != "") && (txtPassword.Text != "")) { m_formSettings.Save(); doLogin(txtUserName.Text.Trim(), txtPassword.Text); } else { MessageBox.Show(I18n.L.T("LoginForm.FillAllFields"), "Waveface", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { FormSettings.FormSize = new Size(Width, Height); FormSettings.SplitterDistance = HorizontalSplitContainer.SplitterDistance; FormSettings.Save(); }
private void SlideShowForm_FormClosing(object sender, FormClosingEventArgs e) { m_formSettings.Save(); }
private void SaveSettings(object sender, EventArgs e) { m_formSettings.Save(); UpdateControls(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { frmSettings1.Save(); }
private void FormServer_FormClosing(object sender, FormClosingEventArgs e) { _formSettings.FormLocation = Location; _formSettings.FormSize = Size; _formSettings.Save(); }