C# Tips: 1.右键单击dataGrivdView选中该行并弹出菜单
处理CellMouseDown事件
if (e.Button == MouseButtons.Right) { if (e.RowIndex >= 0) { dataGridView2.ClearSelection(); dataGridView2.Rows[e.RowIndex].Selected = true; dataGridView2.CurrentCell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex]; this.下拉菜单 .Show(MousePosition.X, MousePosition.Y); } }
浙公网安备 33010602011771号