/// <summary> /// 快捷键 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SupplierMaterial_KeyDown(object sender, KeyEventArgs e) { ///新增(Ctrl+N),编辑(Ctrl+E),删除(Ctrl+D),全部删除(Shift+Delete),过滤(Ctrl+F),刷新(F5) e.Handled = true; if (e.KeyCode == Keys.N && e.Control) { InsToolStripMenuItem.PerformClick(); //执行单击button1的动作 } if (e.KeyCode == Keys.E && e.Control) { UpdToolStripMenuItem.PerformClick(); } if (e.KeyCode == Keys.D && e.Control) { DelToolStripMenuItem.PerformClick(); } if (e.KeyCode == Keys.Delete && e.Shift) { AllDelToolStripMenuItem.PerformClick(); } if (e.KeyCode == Keys.T && e.Control) { ExportExcelToolStripMenuItem.PerformClick(); } if (e.KeyCode == Keys.F5) { RefreshToolStripMenuItem.PerformClick(); } }
private void 全部删除ToolStripMenuItem_Click(object sender, EventArgs e) { AllDelToolStripMenuItem.PerformClick(); }