如何能不让dataGrid(winForm)不能多选,或怎么去掉选中的状态 我的程序大概是这样的:点一下按钮,dataGrid就跳到下一行,现在问题是,点一下,跳到下一行后,刚才那行也处在选中状态。如何能取消一行的选中状态,或者能否不让多选。intFlag++;dataGrid1.CurrentRowIndex=intFlag; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以程序判断,参考:private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { DataGrid.HitTestInfo hti = this.dataGrid1.HitTest(e.X, e.Y); try { if( hti.Type == DataGrid.HitTestType.Cell && hti.Column == 2) { this.dataGrid1[hti.Row, hti.Column] = ! (bool) this.dataGrid1[hti.Row, hti.Column]; } } catch(Exception ex) { MessageBox.Show(ex.ToString()); } } if(intFlag>1)this.dataGrid1.IsSelected(intFlag-1)=false; 不好意思if(intFlag>1)this.dataGrid1.UnSelect(intFlag-1)=false; 不好意思againif(intFlag>1)this.dataGrid1.UnSelect(intFlag-1); excel导入sql 请大家推荐书 treeview 指定层次查找 数据库查询问题 C# 如何统计二进制1的个数 Access数据库连接串这么写为什么不对啊 求救!如何监控IIS资源 请问,怎么模拟键盘右手边的CTRL键?? C#以下代码实现外网IP地址问题! 请教各位高手 发布一款矢量图形二次开发控件,请支持 初学者求教:从HTML中如何获得后台C#代码中变量的值作为相应参数
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
DataGrid.HitTestInfo hti = this.dataGrid1.HitTest(e.X, e.Y);
try
{
if( hti.Type == DataGrid.HitTestType.Cell && hti.Column == 2)
{
this.dataGrid1[hti.Row, hti.Column] = ! (bool) this.dataGrid1[hti.Row, hti.Column];
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
this.dataGrid1.IsSelected(intFlag-1)=false;
if(intFlag>1)
this.dataGrid1.UnSelect(intFlag-1)=false;
if(intFlag>1)
this.dataGrid1.UnSelect(intFlag-1);