{
if (e.Button == MouseButtons.Right)
{
var hti = dgContDrugs.HitTest(e.X, e.Y);
dgContDrugs.ClearSelection();
dgContDrugs.Rows[hti.RowIndex].Selected = true;
dgContDrugs.CurrentCell = dgContDrugs[hti.ColumnIndex, hti.RowIndex];
}
}
or
private void dgContDrugs_CellMouseDown_1(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.Button == MouseButtons.Right)
{
dgContDrugs.CurrentCell = dgContDrugs[e.ColumnIndex, e.RowIndex];
}
}
No comments:
Post a Comment