木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:6864回复:29

[讨论]AE中mapcontrol中右键菜单的实现

楼主#
更多 发布于:2005-08-24 16:48
<P>请问,有没有人在AE里做过mapcontrol的右键菜单,这个菜单不只是控制显示方面的,还能根据点选位置的不同,来调出相应的shp文件。谢谢</P>
喜欢0 评分0
心情卡片 一起分享...
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-08-25 09:43
怎么没有人做过吗?
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2005-08-25 14:13
    If Button = 2 Then<BR>       <BR>            Form1.PopupMenu mmuMapEdit1 ’把mmuMapEdit1改成你的菜单名字<BR>      <BR>    End If
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-08-25 15:42
这个...是不是太少了,菜单怎么做的喃?
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
shixcn
外卖仔
外卖仔
  • 注册日期2003-11-02
  • 发帖数73
  • QQ
  • 铜币180枚
  • 威望0点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
4楼#
发布于:2005-08-27 20:28
<P>Private Sub BuildPopupMenu()<BR>    'Add custom commands to the map menu<BR>    Set m_pMenuMap = New ToolbarMenu<BR>    m_pMenuMap.AddItem New AddData, 1, 0, False, esriCommandStyles.esriCommandStyleIconAndText<BR>    m_pMenuMap.AddItem New LayerVisibility, 1, 1, True, esriCommandStyles.esriCommandStyleTextOnly<BR>    m_pMenuMap.AddItem New LayerVisibility, 2, 2, False, esriCommandStyles.esriCommandStyleTextOnly</P>
<P>    'Add custom commands to the map menu<BR>    Set m_pMenuLayer = New ToolbarMenu<BR>    m_pMenuLayer.AddItem New openattribute, -1, 0, True, esriCommandStyleTextOnly<BR>    m_pMenuLayer.AddItem New RemoveLayer, -1, 0, False, esriCommandStyles.esriCommandStyleIconAndText<BR>    m_pMenuLayer.AddItem New ScaleThresholds, 1, 1, True, esriCommandStyles.esriCommandStyleTextOnly<BR>    m_pMenuLayer.AddItem New ScaleThresholds, 2, 2, False, esriCommandStyles.esriCommandStyleTextOnly<BR>    m_pMenuLayer.AddItem New ScaleThresholds, 3, 3, False, esriCommandStyles.esriCommandStyleTextOnly<BR>    m_pMenuLayer.AddItem New LayerSelectable, 1, 4, True, esriCommandStyleTextOnly<BR>    m_pMenuLayer.AddItem New LayerSelectable, 2, 5, False, esriCommandStyles.esriCommandStyleTextOnly<BR>    m_pMenuLayer.AddItem New ZoomToLayer, -1, 6, False, esriCommandStyles.esriCommandStyleIconAndText<BR>    m_pMenuLayer.AddItem New ClsSymbolSetup, -1, 7, True, esriCommandStyleTextOnly<BR>    'Add pre-defined menu to the map menu as a sub menu<BR>    m_pMenuLayer.AddSubMenu "esriControlCommands.ControlsFeatureSelectionMenu", 8, True<BR>    'Set the hook of each menu<BR>    m_pMenuLayer.SetHook MapControl1<BR>    m_pMenuMap.SetHook MapControl1<BR>End Sub</P><img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-08-28 10:16
<P>楼上的兄弟,谢谢,但是这个是不是只是控制显示方面的,我找到一个AO方面的,但是不知道怎么改</P>
<P>Private Function MxDocument_OnContextMenu(ByVal X As Long, ByVal Y As Long) _<BR>                 As Boolean<BR>                 On Error GoTo Error_h:<BR>                 </P>
<P>  ' Create a sortcut menu.<BR>  Dim pMxDoc As IMxDocument<BR>  Dim pActiveView As IActiveView<BR>  Dim pPoint As IPoint<BR>  Dim pFeature As IFeature<BR>  Dim player As ILayer<BR>  Set pMxDoc = Application.Document<BR>  Set pActiveView = pMxDoc.FocusMap<BR> <BR>  Set pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)<BR>  <BR>  Set pFeature = FindFeature(pMxDoc.SearchTolerance, pPoint, pMxDoc.FocusMap)  ' 调用findfeature过程</P>
<P>  Set player = pMxDoc.SelectedLayer</P>
<P>If player.name = "乡镇区划图" Then<BR>Dim Tname As String<BR>xxxx = player.name<BR>  Tname = pFeature.Value(2)<BR>  Tfile = Tname<BR>  Dim pContextMenu As ICommandBar<BR>  Set pContextMenu = CommandBars.Create("MyContextMenu", esriCmdBarTypeShortcutMenu)<BR>    <BR>  ' Add 3 built in commands to the new context menu using the built in<BR>  ' ArcID module.<BR>  'pContextMenu.CreateMenu Tname<BR>  <BR>  pContextMenu.CreateMacroItem Tname + "土地利用现状图", -1, "normal.module1.xzt"<BR>  pContextMenu.CreateMacroItem Tname + "土壤图", -1, "normal.module1.trt"<BR>  pContextMenu.CreateMacroItem Tname + "地形图", -1, "normal.module1.dxt"<BR>  pContextMenu.CreateMacroItem Tname + "有效磷", -1, "normal.module1.yxp"<BR>  pContextMenu.CreateMacroItem Tname + "有效钾", -1, "normal.module1.yxk"<BR>  pContextMenu.CreateMacroItem Tname + "有效氮", -1, "normal.module1.yxn"<BR>  pContextMenu.CreateMacroItem Tname + "PH分布图", -1, "normal.module1.ph"<BR>   <BR>  ' Popup the menu.<BR>  pContextMenu.Popup</P>
<P>  ' Let the application know that the OnContextMenu event was handled.<BR>  MxDocument_OnContextMenu = True</P>

<P>ElseIf player.name = "果园分布图" Then<BR>xxxx = player.name<BR>  Tname = pFeature.Value(3)<BR>  Tfile = Tname<BR>  Set pContextMenu = CommandBars.Create("MyContextMenu", esriCmdBarTypeShortcutMenu)<BR>             <BR>  ' Add 3 built in commands to the new context menu using the built in<BR>  ' ArcID module.<BR>  <BR>  pContextMenu.CreateMacroItem Tname + "土壤图", -1, "normal.module1.g_trt"    ' g_trt是调用shp的过程<BR>  pContextMenu.CreateMacroItem Tname + "地形图", -1, "normal.module1.g_dxt"<BR>  pContextMenu.CreateMacroItem Tname + "有效磷", -1, "normal.module1.g_yxp"<BR>  pContextMenu.CreateMacroItem Tname + "有效钾", -1, "normal.module1.g_yxk"<BR>  pContextMenu.CreateMacroItem Tname + "有效氮", -1, "normal.module1.g_yxn"<BR>  pContextMenu.CreateMacroItem Tname + "PH分布图", -1, "normal.module1.g_ph"<BR>  pContextMenu.CreateMacroItem Tname + "鸟瞰图", -1, "normal.module1.sanD"<BR>  pContextMenu.CreateMacroItem Tname + "简介", -1, "normal.module1.htmlfile"<BR>  pContextMenu.CreateMacroItem Tname + "实地图", -1, "normal.module1.jpgfile"<BR>  pContextMenu.Popup</P>
<P>  ' Let the application know that the OnContextMenu event was handled.<BR>  MxDocument_OnContextMenu = True</P>

<P>ElseIf player.name = "江津分副图" Then<BR>xxxx = player.name<BR>  Tname = pFeature.Value(8)<BR>  Tfile = Tname<BR>  'Dim pContextMenu As ICommandBar<BR>  Set pContextMenu = CommandBars.Create("MyContextMenu", esriCmdBarTypeShortcutMenu)<BR>                     <BR>    <BR>  ' Add 3 built in commands to the new context menu using the built in<BR>  ' ArcID module.<BR>  <BR>  pContextMenu.CreateMacroItem Tname, -1, "normal.module1.g_fft"<BR>  pContextMenu.Popup</P>
<P>  ' Let the application know that the OnContextMenu event was handled.<BR>  MxDocument_OnContextMenu = True<BR>End If<BR>Error_h:</P>
<P>End Function</P>
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
6楼#
发布于:2005-08-28 10:54
<P>如果你有所有的模块,模块编写用的arcmap的接口比较少的话,就比较好改了</P>
<P>菜单用vb做个菜单了,简单:),调用相应的功能函数啊</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2005-08-29 09:09
关键就是不知道函数怎么写,要用到什么接口
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
8楼#
发布于:2005-08-30 15:19
在不知道功能的情况下,谁也不知道用什么接口了
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
9楼#
发布于:2005-08-31 09:18
那个代码的功能就是通过ipoint来识别feature,根据feature的不同构建一个菜单来调用不同的shp文件
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
上一页
游客

返回顶部