读书人

怎么控制按tab在datagridview跳动

发布时间: 2012-02-14 19:19:19 作者: rapoo

如何控制按tab在datagridview跳动
如何控制按tab在datagridview跳动

[解决办法]

C# code
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)        {            if (e.KeyCode == Keys.Tab) e.Handled = true;        }
[解决办法]
C# code
private void dataGridView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)        {            if (e.KeyCode == Keys.Tab)            {                int row = this.dataGridView1.CurrentCell.RowIndex;                int cel=this.dataGridView1.CurrentCell.ColumnIndex;                row = (row + 2) % this.dataGridView1.Rows.Count;                this.dataGridView1.CurrentCell = this.dataGridView1.Rows[row].Cells[cel];            }        } 

读书人网 >C#

热点推荐