* UIDataGridView:增加EnterAsTab属性,编辑输入时,用Enter键代替Tab键跳到下一个单元格

This commit is contained in:
Sunny 2021-04-01 21:56:09 +08:00
parent 0980e2cc52
commit 4810a79d26
6 changed files with 33 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -23,6 +23,7 @@
* 2020-08-22: V2.2.7
* 2020-08-28: V2.2.7
* 2021-03-25: V3.0.2
* 2021-04-01: V3.0.2 Enter键代替Tab键跳到下一个单元格
******************************************************************************/
using System;
@ -589,6 +590,38 @@ namespace Sunny.UI
{
return Rows.Add(values);
}
protected override bool ProcessDialogKey(Keys keyData)
{
if (EnterAsTab)
{
Keys key = (keyData & Keys.KeyCode);
if (key == Keys.Enter)
{
//交由自定义控件处理
return false;
}
}
return base.ProcessDialogKey(keyData);
}
protected override bool ProcessDataGridViewKey(KeyEventArgs e)
{
if (EnterAsTab)
{
if (e.KeyCode == Keys.Enter)
{
return this.ProcessTabKey(e.KeyData);
}
}
return base.ProcessDataGridViewKey(e);
}
[DefaultValue(false)]
[Description("编辑输入时用Enter键代替Tab键跳到下一个单元格"), Category("SunnyUI")]
public bool EnterAsTab { get; set; }
}
public static class UIDataGridViewHelper