阅读:2692回复:5
toccontrol右键菜单子菜单功能不可用
<P>我现在实现了toccontrol右键菜单,但是想通过itoolbarmenu.addsubmenu方法来构建子菜单,结果本来在主菜单中可以实现的功能,移植到子菜单中之后,就处于冻结状态,相关代码如下,请大家帮忙看看!<BR>m_Pmenuglobe = New ToolbarMenuClass<BR> m_Pmnulayersvis = New ToolbarMenuClass<BR> m_Pmnulayersvis.Caption = "图层可见性"<BR> m_Pmnulayersvis.AddItem(New layersvis, 1, 0, False, esriCommandStyles.esriCommandStyleTextOnly)<BR> m_Pmnulayersvis.AddItem(New layersvis, 2, 1, False, esriCommandStyles.esriCommandStyleTextOnly)<BR> m_Pmenuglobe.AddSubMenu(m_Pmnulayersvis, 0, False)<BR> m_Pmenuglobe.AddItem(New globepros, -1, 1, True, esriCommandStyles.esriCommandStyleTextOnly)</P>
|
|
1楼#
发布于:2005-11-03 10:35
<P>在开发包里有个 PopupMenu的例子</P>
<P>Description: <BR><BR>This sample demonstrates creating a popup menu and uses the ToolbarControl in conjunction with the MapControl and Control Commands. </P> <br> <P>The AddItem method is used within the Form_Load event to add new item's to the ToolbarControl with their Style set. An IMenuDef object is created from a menu defined within the same application. The menu is defined within a class implementing the IMenuDef interface and is made up of default ToolbarControl commands. This MenuDef is added to a ToolbarMenu using the AddItem method and the ToolbarMenu's Hook property is set to the ToolbarControl. Within the MapControl's OnMouseDown event the PopupMenu method is used to display the ToolbarMenu when the right mouse button has been used. </P> |
|
|
2楼#
发布于:2005-11-24 14:52
.net中不行?
|
|
|
3楼#
发布于:2005-12-05 21:14
这个问题我还是没有解决,以前没有用子菜单的时候还是可以用的,当修改成为利用子菜单之后,就不能用了,而且右键菜单也不出来了,我检查了程序没有问题啊!不知道什么原因!
|
|
5楼#
发布于:2006-09-01 11:39
恩是这样的,我也是,就是不能right click的
|
|