0
ProgramEngines = ContextMenu.Controls.Add(Type:=Office.MsoControlType.msoControlPopup, Before:=1)
With ProgramEngines
.Caption = "Program Engines"
With .Controls.Add(Type:=Office.MsoControlType.msoControlPopup, Before:=1)
.Caption = "Gas"
For intCnt = 0 To colEngineData.Count - 1
If Strings.Split(colEngineData.Item(intCnt), "~")(0) = "Gas" Then
**PEG** = .Controls.Add(Type:=Office.MsoControlType.msoControlButton)
With PEG
.Caption = Strings.Split(colEngineData.Item(intCnt), "~")(1)
.FaceId = 548
End With
End If
Next
End With
XCCEngines = ContextMenu.Controls.Add(Type:=Office.MsoControlType.msoControlPopup, Before:=2)
With XCCEngines
.Caption = "XCC Engines"
With .Controls.Add(Type:=Office.MsoControlType.msoControlPopup, Before:=1)
.Caption = "Gas"
For intCnt = 0 To colEngineDataXCC.Count - 1
If Strings.Split(colEngineDataXCC.Item(intCnt), "~")(0) = "Gas" Then
**XCCG** = .Controls.Add(Type:=Office.MsoControlType.msoControlButton)
With XCCG
.Caption = Strings.Split(colEngineDataXCC.Item(intCnt), "~")(1)
.FaceId = 548
End With
End If
Next
End With
Private Sub ButtonClick(ByVal ctrl As Office.CommandBarButton, ByRef Cancel As Boolean) Handles PEG.Click, XCCG.Click
PutValue_Engine_Trans(ctrl.Caption)
End Sub
我必須建立與子菜單(PEG,XCCG)上下文菜單,我已經連接了submenu.But事件處理程序,當我運行代碼事件只發射第一個事件PEG 請幫助我。我是VSTO的新手。事件處理程序添加到右鍵菜單子菜單中VSTO Vb.net
嗨請幫我這個。 –