阅读:8320回复:42
[讨论](老大再麻烦你一下)AE编写专题地图的浏览
<STRONG>主要的专题地图是一些shape文件,由于小弟没有做过,查了一些资料,是不是通过定制tool和toolbar这个思路来实现呢?还有,在VB中引用tool是通过调用dll文件来实现,是不是需要把调用shape的类模块编译成dll文件,怎么编译,还请指教!!!</STRONG><img src="images/post/smile/dvbbs/em12.gif" />
[此贴子已经被作者于2005-7-4 10:33:11编辑过]
|
|
|
1楼#
发布于:2005-07-27 15:17
<P>问题正式宣布结束了,我最后还是选择用activebar来实现,查了一上午的例子,谢谢老大和各位一直的帮助</P>
|
|
|
2楼#
发布于:2005-07-27 13:05
<P>自己写了,这个没办法帮你,写法和arcmap里差不多,只是要识别一些mapcontrol控件了</P>
|
|
|
3楼#
发布于:2005-07-27 11:03
老大,就是没有做过能实现的shape调用的MyLibrary啊?
|
|
|
4楼#
发布于:2005-07-26 22:28
<P>编写一个名字叫MyLibrary的dll,在你的工程里引用你的dll,就可以用他的方法去调用了</P>
<P>dll的写法看帮助和例子了</P> |
|
|
5楼#
发布于:2005-07-26 19:05
<P>这个菜单我也做出来了,但是不能改到我要的效果,象把Fixed Zoom In改成自己定义的命令(调用shape),然后我看到</P>
<P>Private Sub IMenuDef_GetItemInfo(ByVal pos As Long, ByVal itemDef As<BR>esriSystemUI.IItemDef)<BR>Select Case pos 'Commands for the menu<BR>..............................</P> <P>Case 3<BR>itemDef.ID = "MyLibrary.MyCommand"<BR>End Select<BR>End Sub</P> <P>觉得应该可以实现我要的效果,现在就是卡在怎么做这个"MyLibrary.MyCommand"上了,AE自带的那个addshapefile又不能用!郁闷啊!<BR></P> |
|
|
6楼#
发布于:2005-07-26 16:34
|
|
|
7楼#
发布于:2005-07-26 16:30
<P>不管用什么方式,都可以实现你说的功能,如果你用toolbarcontrol做菜单</P>
<P>在\ArcGIS\DeveloperKit\samples\Controls\ToolbarMenuVisual_Basic\ToolbarMenuVisual_Basic\Visual_Basic</P> <P>有例子</P> |
|
|
8楼#
发布于:2005-07-26 16:05
<P>我没有装ArcGIS 只装了AE,这个是定制button的代码?你的意思是要我不要用菜单那条思路,还是转用activebar做的按钮来实现?</P><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
|
|
|
9楼#
发布于:2005-07-26 10:33
<P 17.95pt">本例要实现的是如何创建定制的按钮(Button)。</P>
<P 39pt; TEXT-INDENT: -39pt">l 要点</P> <P 0.05pt; TEXT-INDENT: 17.95pt">用户通过在类模块中实现ICommand接口来创建定制的按钮(COM command)。ICommand接口包括 caption、 name、 category、 bitmap、 message(StatusBarr的提示信息)、 tooltip(微帮助)、 help context id 、help file、enabled以及checked等十个属性和OnCreate、 OnClick两个事件。从Icommand接口的OnCreate事件中获取的ArcMap的Application实例必须用一个公共变量保存,以便在其它事件中(或者其它接口的事件中甚至整个工程中)使用。</P> <P 17.95pt">·OnCreate事件的参数hook传入的是一个Object,也就是ArcMAP的Application实例,可把它赋给一个IApplication接口的变量,便获得了ArcMAP的实例。</P> <P 17.95pt; TEXT-INDENT: 0.05pt">·在OnClick事件中写入相关代码,表示按下按钮时要实现的功能.</P> <P 39pt; TEXT-INDENT: -39pt">l 程序说明</P> <P 17.95pt; TEXT-INDENT: 0.05pt">程序在类模块中实现Icommand接口来创建自己的按钮(Button)</P> <P 39pt; TEXT-INDENT: -39pt">l 代码</P> <TABLE height=2202 width=541 align=center border=0> <TR> <TD width=531 height=2198> <P><CODE>Option Explicit</CODE><CODE><BR>'实现Icommand接口<BR>Implements ICommand<BR>Dim m_pPicture as Picture<BR>Dim m_pApplication As IApplication<BR><BR>Private Sub Class_Initialize()<BR> '调入.RES文件中ID为101的BitMap作为该按钮的显示图片<BR> Set m_pPicture = LoadResPicture(101, vbResBitmap)<BR>End Sub</CODE></P> <P><CODE>Private Property Get ICommand_Bitmap() As esriCore.OLE_HANDLE<BR> ICommand_Bitmap = m_pPicture<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_Caption() As String<BR> ICommand_Caption = "Create Button"<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_Category() As String<BR> ICommand_Category = " Create Button "<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_Checked() As Boolean<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_Enabled() As Boolean<BR> ICommand_Enabled = True<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_HelpContextID() As Long<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_HelpFile() As String<BR>End Property</CODE></P> <P><CODE>Private Property Get ICommand_Message() As String<BR>End Property</CODE></P> <P>Private Property Get ICommand_Name() As String<BR>ICommand_Name = " CreateButton "<BR>End Property</P> <P>Private Sub ICommand_OnClick()<BR> '加入按下按钮时实现的功能代码。在这里,<BR> '按钮按下时显示ArcMap的Document的Tittle<BR> Dim pDocument As IDocument<BR> Set pDocument = m_pApplication.Document<BR> MsgBox pDocument.Title<BR>End Sub</P> <P>Private Sub ICommand_OnCreate(ByVal hook As Object)<BR> '获取ArcMap的Application实例<BR> Set m_pApplication = hook<BR>End Sub</P> <P>Private Property Get ICommand_Tooltip() As String<BR> ICommand_Tooltip = " Create Button "<BR>End Property</P> <P>Private Sub ITool_OnDblClick()<BR> '在这里加入Mouse双击时的功能代码<BR>End Sub </P> <P>Private Sub ITool_OnKeyDown(ByVal keyCode As Long, ByVal Shift As Long)<BR>End Sub </P> <P>Private Sub ITool_OnKeyUp(ByVal keyCode As Long, ByVal Shift As Long)<BR>End Sub </P> <P 32pt; TEXT-INDENT: -32pt">Private Sub ITool_OnMouseDown(ByVal Button As Long, ByVal Shift As Long, _<BR>ByVal X As Long, ByVal Y As Long)<BR> '加入Mouse单击时的功能代码<BR> If Button = 1 Then<BR> Dim pPoint As IPoint<BR> Dim pMxApplication As IMxApplication<BR> Set pMxApplication = m_pApp<BR> Set pPoint=pMxApplication.Display.DisplayTransformation.ToMapPoint(X, Y)<BR> m_pApplication.StatusBar.Message(0) = Str(pPoint.X) ; "," ; Str(pPoint.Y)<BR> End If</P> <P>End Sub</P> <P>Private Sub ITool_OnMouseMove(ByVal Button As Long, ByVal Shift As Long, _<BR> ByVal X As Long, ByVal Y As Long)<BR> '加入Mouse移动时的功能代码<BR> m_pApplication.StatusBar.Message(0) = "ITool_OnMouseMove"<BR>End Sub</P> <P>Private Sub ITool_OnMouseUp(ByVal Button As Long, ByVal Shift As Long, _<BR> ByVal X As Long, ByVal Y As Long)<BR> '加入释放Mouse时的功能代码<BR> m_pApplication.StatusBar.Message(0) = "ITool_OnMouseUp"<BR>End Sub</P> <P>Private Sub ITool_Refresh(ByVal hDC As esriCore.OLE_HANDLE)<BR>End Sub</P></TD></TR></TABLE> |
|
|
上一页
下一页