DataGrid KeyDown问题 [英] DataGrid KeyDown problem

查看:79
本文介绍了DataGrid KeyDown问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为myGrid的DataGrid.
我想使用keyDown事件来识别箭头键.
但这是行不通的.
选中的行的SelectionBackColor随我单击一行而变为蓝色,但选中的单元格的backColor却没有变为.
因此keyDown事件不会触发.
我不能使用箭头键,除非所选行的颜色与所选单元格一起变成蓝色.
如果我选择行标题,它的工作原理.
我在Grid的CurrentCellChanged事件中发送完整的行选择代码.
有谁知道为什么选择单元格文本后事件不会触发?
或事件如何触发?
对不起,我英语不好..


i have a DataGrid named myGrid.
I want to use the keyDown event to recognize the arrow keys.
But it doesn''t work.
Selected row''s SelectionBackColor turns blue with i clicked on a row, but selected cell''s backColor not turn.
therefore the keyDown event won''t fire.
i cant use arrow keys, unless selected row''s color turn blue together selected cells.
if i select row header, it works.
i''m sendin full row selection code that in Grid''s CurrentCellChanged event.
Does anyone know why the event wont fire when a cell''s text selected?
or how the event fires?
sorry my bad english..


private void myGrid_CurrentCellChanged(object sender, EventArgs e)
        {
            myGrid.Select(myGrid.CurrentCell.RowNumber);            
        }

推荐答案

抛出该链接,它对您很有帮助,您会得到想要的


http://social.msdn.microsoft.com /forums/zh-CN/winformsdatacontrols/thread/dc6d4d47-dbb1-42d5-954e-16c5645c89bb/ [
go throw this link its very helpful you will get want you want


http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/dc6d4d47-dbb1-42d5-954e-16c5645c89bb/[^]





Thanks & Regard Aarti.Thakkar (nemo)
Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you... :thumbsup::thumbsup::rose:


这篇关于DataGrid KeyDown问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆