/// <summary>
/// 全局变量: 判断dataGridView 是否处于编辑状态
/// </summary>
private bool m_isdataGridViewBegingEdit = false;
/// 全局变量: 判断dataGridView 是否处于编辑状态
/// </summary>
private bool m_isdataGridViewBegingEdit = false;
protected override bool
ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Enter && (m_isdataGridViewBegingEdit == true || this.dataGridView1.Focused == true))
{
System.Windows.Forms.SendKeys.Send("{tab}");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
{
if (keyData == Keys.Enter && (m_isdataGridViewBegingEdit == true || this.dataGridView1.Focused == true))
{
System.Windows.Forms.SendKeys.Send("{tab}");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
m_isdataGridViewBegingEdit = true;
}
{
m_isdataGridViewBegingEdit = true;
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
m_isdataGridViewBegingEdit = false;
}
{
m_isdataGridViewBegingEdit = false;
}