DataGridView右键选中行

private void dgvCatelogList_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right && e.RowIndex > -1 && e.ColumnIndex > -1)
{
dgvCatelogList.CurrentRow.Selected = false;
dgvCatelogList.Rows[e.RowIndex].Selected = true;
}
}

你可能感兴趣的:(datagridview)