如何修改动态加载的menuitem的onclick事件 0

 我来答
甜含艺
2017-08-20 · TA获得超过194个赞
知道小有建树答主
回答量:598
采纳率:0%
帮助的人:342万
展开全部
#Region "DataGridView右键菜单"
Public Sub SetContextMenuStrip()
Dim ToolStripMenuItem1 As New System.Windows.Forms.ToolStripMenuItem("查找定位")
Dim ToolStripMenuItem2 As New System.Windows.Forms.ToolStripMenuItem("记录范围筛选")
Dim ToolStripMenuItem3 As New System.Windows.Forms.ToolStripMenuItem("固定列")
Dim ToolStripMenuItem4 As New System.Windows.Forms.ToolStripMenuItem("多列排序")
Dim ContextMenuStrip1 As New ContextMenuStrip
MyGrid.ContextMenuStrip = ContextMenuStrip1
With ContextMenuStrip1.Items
.Add(ToolStripMenuItem1)
.Add(ToolStripMenuItem2)
.Add(ToolStripMenuItem3)
End With
AddHandler ToolStripMenuItem1.Click, AddressOf ToolStripMenuItem_Click
AddHandler ToolStripMenuItem2.Click, AddressOf ToolStripMenuItem_Click
AddHandler ToolStripMenuItem3.Click, AddressOf ToolStripMenuItem_Click
End Sub
Private Sub ToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Select Case sender.text
Case "查找定位"
Me.ShowGridFind()
Case "记录范围筛选"
Me.ShowGridFilter()
Case "固定列"
Me.ShowGridColumn(ColumnProperty.固定列)
End Select
End Sub
#End Region
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式