|
This can be done in DataGridView:
private int _selecting_index = 0;
private void dataGridView1_MouseMove(object sender, MouseEventArgs e)
{
DataGridView.HitTestInfo hti = this.dataGridView1.HitTest(e.X, e.Y);
//If the coordinates are in the cell
if (hti.Type == DataGridViewHitTestType.Cell)
{
if (_selecting_index != hti.RowIndex)
{
// this.dataGridView1.Rows[_selecting_index].DefaultCellStyle.BackColor = Color.White;
this.dataGridView1.Rows[hti.RowIndex].Selected = true;
_selecting_index = hti.RowIndex;
}
}
}
among them
this.dataGridView1.MultiSelect = false;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; |
|