阅读:2383回复:3
请教AO+VB.NET右键弹出菜单事件的问题
<P>各位大虾,又没有碰到这个情况阿:</P>
<P> 在Mapcontrol中使用鼠标右键弹出菜单的时候,菜单点击事件无效阿?是怎么解决的?开发环境是:Mapcontrol+VB.Net。</P> <P>急!</P> |
|
|
1楼#
发布于:2004-09-03 20:20
能说详细点?
|
|
2楼#
发布于:2004-09-04 12:56
这种情况我也遇到过,别的事件都可以,就这个时间不行,Click在传递过程中出错了,这个问题没有解决办法,只能走的方法实现自己要做的事,不知你准备要做什么?
|
|
3楼#
发布于:2004-11-15 13:07
<P>From the developer help:
ICustomizationFilter Example 这个例子建立了一个myfilter的类模块来锁定toolbar上的右键弹出菜单.</P> <P> The lock is activated by the OpenDocument event of a document. This lock does the following 3 things: </P> <P>Prevents the Visual Basic Editor from being opened. Locks the Map and Edit categories. These categories will not appear in the Categories list on the Commands panel of the Customize dialog. This prevents users from dragging the commands in these categories onto toolbars. Locks the What's This Help command. This command will not show up in the Commands list for the Help category on the Commands panel of the Customize dialog. This prevents users from dragging this command onto a toolbar but still gives them access to the other commands in the Help category. The class for MyFilter implements the ICustomizationFilter interface and uses use the esriCEAddCategory, esriCEAddCommand, and esriShowVBAIDE customization event types. </P> <P>例子里包括 MyFilter.cls Class module for the custom customization filter. MxDocument_OpenDocument function VBA code for ThisDocument open document event. </P> <P>两个文件。</P> <P>使用方法:</P> <P>Start ArcMap and open the Visual Basic Editor. Import MyFilter.cls into Project. Copy the MxDocument_OpenDocument code into the Projects's ThisDocument code window. Save the document and open it again. The lock should be activated. '======================================================= 在vba中建立一个类模块,取名字为myfilter,把下面的代码拷贝进去</P> <P>'MyFilter.cls Option Explicit Implements ICustomizationFilter Private Function ICustomizationFilter_OnCustomizationEvent(ByVal custEventType As esriCore.esriCustomizationEvent, ByVal eventCtx As Variant) As Boolean ' Lock the Visual Basic editor ' custEventType is esriCEShowVBAIDE ' eventCtx is nothing If custEventType = esriCEShowVBAIDE Then ICustomizationFilter_OnCustomizationEvent = True End If ' Lock the Map and Edit categories. These categories will not appear in the ' Categories list on the Commands panel of the Customize dialog. ' custEventType is esriCEAddCategory ' eventCtx is a string representing the category name If custEventType = esriCEAddCategory Then Select Case eventCtx Case "Map" ICustomizationFilter_OnCustomizationEvent = True Case "Edit" ICustomizationFilter_OnCustomizationEvent = True Case Else ICustomizationFilter_OnCustomizationEvent = False End Select End If ' Lock the What's This Help command. This command will not show up in the Commands ' list for the Help category on the Commands panel of the Customize dialog. ' custEventType is esriCEAddCommand ' eventCtx can be either a UID or a string identifier for a command. If custEventType = esriCEAddCommand Then 'UID for What's This Help command Dim u As New UID u = "{81972F0D-388A-11D3-9F57-00C04F6BC61A}" If u = eventCtx Then ICustomizationFilter_OnCustomizationEvent = True End If End If End Function '================================================= 下面的代码拷贝到thisdocument里面,然后保存下</P> <P>下次启动就回生效了。</P> <P>'================================================= Private Function MxDocument_OpenDocument() As Boolean ' Do error checking in case there is already a lock active. On Error GoTo lockErr 'Create an instance of the custom customization filter, MyFilter Dim m_CustomFilter As ICustomizationFilter Set m_CustomFilter = New MyFilter 'Lock customization using MyFilter Application.LockCustomization "mylock", m_CustomFilter Exit Function lockErr: MsgBox "There is already an active lock.", , "Lock Error" End Function </P> <P> </P> [此贴子已经被作者于2004-11-15 13:40:11编辑过]
|
|
|