ZC_Mo-Blog

 

 在列标题处单击和在内容处单击弹出不同菜单

Private Sub DataGridView1_CellMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView.CellMouseDown

      If e.Button = Windows.Forms.MouseButtons.Right Then
            If e.RowIndex < 0 Then
                  Me.DataGridView1.ClearSelection()
                  Me.菜单1.Show(MousePosition.X, MousePosition.Y)
            Else
                  Me.DataGridView1.ClearSelection()
                  Me.DataGridView1.Rows(e.RowIndex).Selected = True
                  Me.菜单2.Show(MousePosition.X, MousePosition.Y)
            End If
      End If
End Sub

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
猜你喜欢
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-11-14
  • 2021-12-19
相关资源
相似解决方案