book this Windows.Forms FAQ site:
http://www.syncfusion.com/FAQ/WinForms/default.aspsee (hti.Row is the row number):5.7 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
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column);
dataGrid1.Select(hti.Row);
}
}
http://www.syncfusion.com/FAQ/WinForms/default.aspsee (hti.Row is the row number):5.7 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
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column);
dataGrid1.Select(hti.Row);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货