private void EditClientForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { SaveButton.PerformClick(); } }
/// <summary> /// 最后一个控件回车时的回调 /// </summary> protected void LastControlAction() { if (IsNew) { if (SaveNewButton != null && SaveNewButton.Enabled) { SaveNewButton.Select(); SaveNewButton.PerformClick(); } else { SelectFirstControl(); } } else { if (SaveButton != null && SaveButton.Enabled) { SaveButton.Select(); SaveButton.PerformClick(); } else { SelectFirstControl(); } } }
private void EditForm_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.F4: if (e.Alt) { if (MessageBox.Show( "Редактирование еще не завершено.\nВы действительно желаете закрыть это окно?", "Стоп-стоп-стоп...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Handled = true; } } break; case Keys.Enter: if (e.Control) { SaveButton.PerformClick(); } break; } }
private void nameTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { SaveButton.PerformClick(); e.SuppressKeyPress = true; } }
private void FormKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.S && e.Control) { SaveButton.PerformClick(); } if (e.KeyCode == Keys.Z && e.Control) { BackButton.PerformClick(); } }
//新建工程 public void NewProject() { if (myProjectPath != "") { if (DialogResult.No == MessageBox.Show("工程已存在,确实要新建吗?", "Alert", MessageBoxButtons.YesNo)) { return; } SaveButton.PerformClick(); //关闭工程 CloseProject(); myProjectPath = ""; } foreach (EditWin m_edit in drawToolWindow.editWinList) { m_edit.Close(); } drawToolWindow.editWinList.Clear(); FormNewProject proj = new FormNewProject(); if (proj.ShowDialog() == DialogResult.OK) { string ProjPath = proj.projPath; string myProjName = proj.projName; string s = ProjPath.Substring(ProjPath.Length - 1, 1); if (s == "\\") { myProjectPath = ProjPath + myProjName + "\\"; myProjectFullName = myProjectPath + myProjName + ".mproj"; } else { myProjectPath = ProjPath + "\\" + myProjName + "\\";; myProjectFullName = myProjectPath + myProjName + ".mproj"; } DirectoryInfo dir = new DirectoryInfo(myProjectPath); dir.Create(); //bDirty = true; drawToolWindow.myProjectFullName = myProjectFullName; drawToolWindow.myProjectPath = myProjectPath; XmlDocument doc = new XmlDocument(); doc.LoadXml("<MProj></MProj>"); doc.Save(myProjectFullName); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) // closing SW { if (first == true) // if connection still on send Stop command { sensport.Write(StpData); } Plothandle = true; if (LogScreen.Text != string.Empty) // if there is data ask for save { DialogResult result1 = MessageBox.Show("Do you want to save the data before exit?", "Save Data", MessageBoxButtons.YesNo); if (result1 == DialogResult.Yes) { SaveButton.PerformClick(); } } }
private void EditorForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { Clipper.Terminate(); } if (e.KeyCode == Keys.Z && e.Modifiers == Keys.Control && UndoToolStripButton.Enabled) { UndoToolStripButton.PerformClick(); } if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control) { ClipboardBbutton.PerformClick(); } if (e.KeyCode == Keys.S && e.Modifiers == Keys.Control) { SaveButton.PerformClick(); } }
private void SaveTButton_Click(object sender, EventArgs e) { SaveButton.PerformClick(); }
private void SaveAndExitClick(object sender, EventArgs e) { isAlive = false; SaveButton.PerformClick(); }
//退出按钮 private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) { SaveButton.PerformClick();//save and exit this.Close(); }