|
5.10 How can I select the entire row when the user clicks on a cell in the row?
|
Call the DataGrid.Select method from within its mouseup event.
|
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);
|
Private Sub dataGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dataGrid1.MouseUp
|
Dim pt = New Point(e.X, e.Y)
|
Dim hti As DataGrid.HitTestInfo = dataGrid1.HitTest(pt)
|
If hti.Type = DataGrid.HitTestType.Cell Then
|
dataGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column)
|
dataGrid1.Select(hti.Row)
|
|
|
|