开发者

C# DataGridView : override keydown events

i am working with DataGridView trying to provide specific ut开发者_如何学Pythonility to my user...

what i want to do is when some key is presses instead of the normal function that the key was supposed to perform like updown arrows and page up down keys etc i want to stop the default action

like when on a selected row, datagrid in selectfullrow, when down arrow is press it shouldn't change the row selection or goto the next row


You should handle the KeyDown event and set the e.Handled to true to disable the default action:

    private void dataGridView1_KeyDown(object sender, KeyEventArgs e) {
        e.Handled = e.KeyCode == Keys.Down;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜