[英]How to capture enter key in DataGridView CellContentClick
如何在C#中的DataGridView.CellContentClick中捕获enter key
only the spacebar
is handled, so you have to capture the KeyUp event
on the cell first and raise the CellContentClick if you want that . 仅处理
spacebar
,因此您必须先捕获单元格上的KeyUp event
,并在需要时引发CellContentClick。
private void cell_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
{
// modify/cast/transform e here to DataGridViewCellEventArgs
dataGridView_CellContentClick(sender, e)
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.