C#: winform--DataGrid 中为什么不能回车? 另外: 当点击列头时,如何使该列的所有checkbox全选/全不选? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 重写DataGrid,www.codeproject上有很多功能比较强的DataGrid的源码。不知道还有别的什么办法。 请参考: protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { if(keyData == Keys.Enter)//通过回车键移到下一控件 { if(this.ActiveControl.Parent is DataGrid) { SendKeys.Send("{DOWN}"); return true; } else if(!(this.ActiveControl is Button)) { SendKeys.Send("{TAB}"); SendKeys.Send("{END}+{HOME}"); return true; } } return base.ProcessCmdKey(ref msg, keyData); } 同意 iwishflying(云儿) 覆盖ProcessCmdKey方法 初学者求救 C#新建Excel文件,并添加VBA宏代码、运行VBA宏代码 关于C#中调用打印的问题 正则表达式!? 关于文件控制的问题 我的机器分配有多个ip,如何在程序里指定其中一个发出网络请求 help me xml读取的问题 有自动增长列的表如何用dataAdaper的update()方法修改数据? 一个关于tcpClient 的问题,请高手帮忙!!!!!!!!!!!!急!!!!!!!!!! 心情好散分(有条件) 关于在Rose和.net,希望大家给给看法 一个前所未有的窗体问题(绝不同于以前的帖子,跟帖者有分)
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
if(keyData == Keys.Enter)//通过回车键移到下一控件
{
if(this.ActiveControl.Parent is DataGrid)
{
SendKeys.Send("{DOWN}");
return true;
}
else if(!(this.ActiveControl is Button))
{
SendKeys.Send("{TAB}");
SendKeys.Send("{END}+{HOME}");
return true;
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
覆盖ProcessCmdKey方法