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

 

 

 

相关文章:

  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
猜你喜欢
  • 2021-06-29
  • 2021-09-08
  • 2022-12-23
  • 2021-10-15
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案