DataGrid如何行选中 CurrencyManager cm;cm=(CurrencyManager) BindingContext[dataGrid1.DataSource];如要让第行选中(小三角移到该行),则如下表示:cm.Position=4 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把dataGrid设置为只读属性,即使用户还可以在网格中用鼠标点击而选择某一格,但改不了其中的数据。 int i = 7;DataGrid1.SelectedIndex = i; 我帮你写一个datagrid事件:单击datagrid中某个单元格即选定该行private void yourDataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){ System.Drawing.Point pt = new Point(e.X, e.Y); DataGrid.HitTestInfo hit = this.yourDataGrid.HitTest(pt); if(hit.Type == DataGrid.HitTestType.Cell) { this.yourDataGrid.CurrentCell = new DataGridCell(hit.Row, hit.Column); this.yourDataGrid.Select(hit.Row); } }顺便说一句,分这么重要么?给5分? 求救英语达人 怎么样用SerialPort获取手机卡(SIM卡)的卡号 C# 中ListView如何 编辑某一项 求助】C#连接SQL失败 关于C#+ASP.NET入门 优惠策略的算法求救。 DLL的event时间如何触发 C#3.0中有多重继承? 关于DialogResult的问题,跟了半天了我的神,一直有问题 如何高效地将大批量记录导入到数据库?如10万条,存放在文本文件中. VC 和 C# 真的差别到家了。。。 急,C#程序编译后无法执行,drawing.dll溢出,如何解决???
DataGrid1.SelectedIndex = i;
private void yourDataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hit = this.yourDataGrid.HitTest(pt);
if(hit.Type == DataGrid.HitTestType.Cell)
{
this.yourDataGrid.CurrentCell = new DataGridCell(hit.Row, hit.Column);
this.yourDataGrid.Select(hit.Row);
}
}
顺便说一句,分这么重要么?给5分?