在WINCC中可以通过如下代码给 图形编辑器添加菜单
??Dim Brildo_Menu As HMIMenu
Set Brildo_Menu = Application.CustomMenus.InsertMenu(1, "AppMenu1", "ToolBox")
?如何给添加的菜单添加事件呢(执行代码的过程)
最佳答案
''先执行这个:
Private Sub SetApplication()
Set objGDApplication = grafexe.Application
End Sub
''点击key为mItem1_1后弹出Msgbox,你问题中的key是APPMenu1:
Private Sub Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)
Dim objMenuItem As HMIMenuItem
Dim varMenuItemKey As Variant
Set objMenuItem = MenuItem
varMenuItemKey = objMenuItem.Key
Select Case MenuItem.Key
Case "mItem1_1"
MsgBox "The first menu-item was clicked!"
End Select
End Sub
<参考WinCC帮助中MenuItemClicked事件>
提问者对于答案的评价:
谢谢。我在网上找到其它方式的实现方法。https://support.industry.siemens.com/cs/mdm/109742330?c=46146394763&t=1&s=MenuItems.InsertMenuItem&lc=zh-CN
原创文章,作者:ximenziask,如若转载,请注明出处:https://www.zhaoplc.com/plc356416.html