this.dataGrid1.CurrentRowIndex=你想要的那个行;这就选中
解决方案 »
- 求助:DrawLine后的笔迹如何保存,如何擦除?
- 判断字符串中引号是否存在
- 怎么将datatable的一整列移动到新的datatable中,不遍历 能实现么
- C#初学问题
- 创建两个窗体,如何让他们在桌面保持同一层
- 【急,在线等,分不够再加】在线快来帮忙看看Windows程序中的SQL问题
- 关于winform中实现动画效果
- 怎么用treeview实现选择本地硬盘每个盘子路径的功能
- wpf RichTextbox 设置选中行的居中模式
- 凡是贴主发起的含有人身攻击性的帖子,必删之.
- 数据库添加问题!!!!!谢谢!!!!!!!!!1
- C#WINDOWS应用主程序使用form时如何接受传递进来的参数?
{
DataGrid.HitTestInfo hti = this.HitTest(new Point(e.X, e.Y));
switch ( hti.Type )
{
case DataGrid.HitTestType.Cell:
{
switch( e.Button )
{
case MouseButtons.Right:
{
return;
}
case MouseButtons.Middle:
{
return;
}
case MouseButtons.Left:
{
base.OnMouseDown(e);
this.SelectRow(); break;
}
}
break;
}
}方法2、添加OnMouseDown事件或OnClick事件。在事件中写同样的代码。更多信息:http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp
How can I select the entire row when the user clicks on a cell in the row?
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q689q