DataGridView右键单击弹出菜单并选中行

private void dataGridView_OLUsers_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (e.RowIndex >= 0) { dataGridView_OLUsers.ClearSelection(); dataGridView_OLUsers.Rows[e.RowIndex].Selected = true; dataGridView_OLUsers.CurrentCell = dataGridView_OLUsers.Rows[e.RowIndex].Cells[e.ColumnIndex]; contextMenuStrip1.Show(MousePosition.X, MousePosition.Y); } } }

上一篇:Crystal和Oscillator的区别


下一篇:c#datagridview绑定的数据源不显示