本文介绍了如何在C#windows应用程序的datagridview中输入键作为tab键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了大量的代码,但我不明白输入键的行为方式如同tab键datagridview
我尝试了什么:
i use lots of code but i dont understand how enter key behave as tab key datagridview
What I have tried:
private void dgvSbill_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (dgvSbill.CurrentRow.Cells[e.ColumnIndex].ReadOnly)
{
SendKeys.Send("{tab}");
}
}
second i used
private void dgvSbill_KeyPress(object sender, KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case (char)Keys.Enter:
SendKeys.Send("{Tab}");
break;
default:
break;
}
}
i also check this process code but how it use i cant understand
using System.Diagnostics;
class MyDataGridView : DataGridView
{
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Enter) {
base.ProcessTabKey(Keys.Tab);
return true;
}
return base.ProcessDialogKey(keyData);
}
protected override bool ProcessDataGridViewKey(KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) {
base.ProcessTabKey(Keys.Tab);
return true;
}
return base.ProcessDataGridViewKey(e);
}
}
哪里会用plz回复我非常紧急
提前感谢
where it will use plz reply me it very urgent
thanks in advance
推荐答案
这篇关于如何在C#windows应用程序的datagridview中输入键作为tab键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!