【发布时间】:2017-12-28 23:37:45
【问题描述】:
我有这段代码,我只能通过 KeyPress 执行,我想通过按钮调用事件,这样它就会像我按下键盘上的实际键一样运行。这是我的代码:
private void dataGridView1_KeyUp(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Down) {
dataGridView1_CellDoubleClick(this.dataGridView1, _
new DataGridViewCellEventArgs(this.dataGridView1.CurrentCell.ColumnIndex, _
this.dataGridView1.CurrentRow.Index));
} else if (e.KeyCode == Keys.Up) {
dataGridView1_CellDoubleClick(this.dataGridView1, _
new DataGridViewCellEventArgs(this.dataGridView1.CurrentCell.ColumnIndex, _
this.dataGridView1.CurrentRow.Index));
}
}
【问题讨论】:
-
数据网格中是否存在按钮??
标签: c# events button datagridview keyup