void dataGridView1_MouseUp(object sender, MouseEventArgs e)
{
var hitTestInfo = dataGridView1.HitTest(e.X, e.Y);
if (hitTestInfo.Type == DataGridViewHitTestType.Cell)
{
if (e.Button == MouseButtons.Right)
{
contextMenuStrip1.Show(dataGridView1, new Point(e.X, e.Y));
selectRow(hitTestInfo.RowIndex);
}
else if (e.Button == MouseButtons.Left)
{
selectRow(hitTestInfo.RowIndex);
}
}
}