免费视频|新人指南|投诉删帖|广告合作|地信网APP下载

查看: 3637|回复: 4
收起左侧

[二次开发] 怎么在自定义菜单中添加自定义按钮?

[复制链接]

9

主题

266

铜板

3

好友

技术员

Rank: 3Rank: 3

积分
97
发表于 2011-9-6 16:45 | 显示全部楼层 |阅读模式
找到一个自定义菜单的例子,但只能把Arcgis内部的按钮加载上去,不知怎么加自己创建的按钮,还望高手们指点下!
Option Explicit

'Implement the IMenuDef interface and IRootLevelMenu interface
Implements IMenuDef
Implements IRootLevelMenu   ' Allows this menu to be added to the Menus category
                             ' in the Customize dialog

Private Property Get IMenuDef_Caption() As String
    ' Set the string that appears as the menu's title
    IMenuDef_Caption = "aa"
End Property

Private Sub IMenuDef_GetItemInfo(ByVal pos As Long, ByVal itemDef As esriSystemUI.IItemDef)
    ' Define the commands that will be on the menu. The built-in ArcMap AddData command,
    ' Full Extent command, and Fixed Zoom In command are added to this custom menu.
    ' ID is the ClassID of the command. Group determines whether the command
    ' begins a new group on the menu
    Select Case pos
    Case 0
      itemDef.ID = "esriArcMapUI.AddDataCommand"
      itemDef.Group = False
    Case 1
      itemDef.ID = "esriArcMapUI.FullExtentCommand"
      itemDef.Group = True
    Case 2
      itemDef.ID = "esriArcMapUI.ZoomInFixedCommand"
      itemDef.Group = False
    Case 3
        itemDef.ID = "esriArcMapUI.MxBookmarksMenu"
        itemDef.Group = False
    End Select

End Sub

Private Property Get IMenuDef_ItemCount() As Long
    ' Set how many commands will be on the menu
    IMenuDef_ItemCount = 4
End Property

Private Property Get IMenuDef_Name() As String
    ' Set the internal name of the menu.
    IMenuDef_Name = "a"
End Property
这里的itemDef.ID怎么才能取到自己创建的按钮的ID?

1

主题

219

铜板

2

好友

技术员

Rank: 3Rank: 3

积分
72
发表于 2013-7-11 23:23 手机频道 | 显示全部楼层
AddItem("id"),id为你自定以的按钮guid,可以直接复制自定义按钮.cs下guid后面括号里的字符串,记得带引号
回复 支持 反对

使用道具 举报

4

主题

3078

铜板

2

好友

高级工程师

Rank: 9Rank: 9Rank: 9

积分
899

爱心勋章

发表于 2021-12-20 08:42 | 显示全部楼层
按楼上说的试试,应该是可以的,
回复 支持 反对

使用道具 举报

30

主题

2万

铜板

59

好友

钻石会员

Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26

积分
6284
QQ
发表于 2022-1-19 13:56 | 显示全部楼层
感谢分享!
回复

使用道具 举报

0

主题

1684

铜板

1

好友

高级工程师

Rank: 9Rank: 9Rank: 9

积分
643
发表于 2022-2-15 13:24 | 显示全部楼层
感谢分享
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

在线客服
快速回复 返回顶部 返回列表