C#中,DataGrid的Row的问题
请问各位朋友:在C#中,DataGrid中,如何在选中任何一个Cell而选中这一行呢?在线等待你的回答,谢谢!! 问题点数:50、回复次数:8Top
1 楼wind_baby(风子)回复于 2004-12-01 22:39:49 得分 5
private void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.SelectedItem)
{
//todo
}
}Top
2 楼CSDNATM(飞行员,麻烦帮开个窗让我透透气)回复于 2004-12-01 22:46:04 得分 10
取得行号即可Top
3 楼lxjqzx(网络游民)回复于 2004-12-01 22:48:47 得分 0
对不起,我说的是在C#的windows应用程序中呀Top
4 楼wind_baby(风子)回复于 2004-12-01 22:58:29 得分 20
int a = dgrd.CurrentCell.RowNumber;Top
5 楼alias88()回复于 2004-12-01 23:10:01 得分 15
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
DataGrid.HitTestInfo info1 = this.HitTest(e.X, e.Y);
Keys keys1 = Control.ModifierKeys;
///选择当前Cell所在的一整行
if(info1.Type == DataGrid.HitTestType.Cell)
{
this.CurrentCell = new DataGridCell(info1.Row, info1.Column);
this.Select(info1.Row);
}
}
Top
6 楼ghs79(ghs)回复于 2004-12-01 23:50:43 得分 0
To Alias88
这段代码怎么调试啊Top
7 楼lmhcn(烟头)回复于 2004-12-02 03:28:14 得分 0
private void dgdetail_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(dgdetail.CurrentRowIndex>=0)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dgdetail.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
dgdetail.CurrentCell = new DataGridCell(hti.Row, hti.Column);
dgdetail.Select(hti.Row);
}
}
}
Top
8 楼lxjqzx(网络游民)回复于 2004-12-02 22:09:44 得分 0
谢谢: lmhcn(苍狼)Top




