|
阅读:1695回复:3
求助,ao 入门问题!
<P>本人菜鸟,迟迟不能入门!</P>
<P>研究ArcGISBook.doc好久,ArcGISBook.doc中给出如下代码,</P> <P><FONT size=2><FONT face=宋体>"OnCreate事件的参数hook传入的是一个Object,也就是ArcMAP的Application实例,可把它赋给一个IApplication接口的变量,便获得了ArcMAP的实例。"</FONT></FONT></P> <P><FONT size=2><FONT face=宋体><FONT size=2>ICommand倒底怎么实现?比如我在加了个</FONT>MapControl控件后,怎么实现?</FONT></FONT></P> <P><FONT size=2><FONT face=宋体>望各位大侠赐教,研究了好多天了啊!</FONT></FONT></P> <P >Option Explicit<p></p></P> <P >'实现Icommand接口<p></p></P> <P >Implements ICommand<p></p></P> <P >Dim m_pPicture as Picture<p></p></P> <P >Dim m_pApplication As IApplication<p></p></P> <P > <p></p></P> <P >Private Sub Class_Initialize()<p></p></P> <P > '调入.RES文件中ID为101的BitMap作为该按钮的显示图片<p></p></P> <P > Set m_pPicture = LoadResPicture(101, vbResBitmap)<p></p></P> <P >End Sub<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Bitmap() As esriCore.OLE_HANDLE<p></p></P> <P > ICommand_Bitmap = m_pPicture<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Caption() As String<p></p></P> <P > ICommand_Caption = "Create Button"<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Category() As String<p></p></P> <P > ICommand_Category = " Create Button "<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Checked() As Boolean<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Enabled() As Boolean<p></p></P> <P > ICommand_Enabled = True<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_HelpContextID() As Long<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_HelpFile() As String<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Message() As String<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Name() As String<p></p></P> <P >ICommand_Name = " CreateButton "<p></p></P> <P >End Property<p></p></P> <P > <p></p></P> <P >Private Sub ICommand_OnClick()<p></p></P> <P > '加入按下按钮时实现的功能代码。在这里,<p></p></P> <P >'按钮按下时显示ArcMap的Document的Tittle<p></p></P> <P > Dim pDocument As IDocument<p></p></P> <P > Set pDocument = m_pApplication.Document<p></p></P> <P > MsgBox pDocument.Title<p></p></P> <P >End Sub<p></p></P> <P > <p></p></P> <P >Private Sub ICommand_OnCreate(ByVal hook As Object)<p></p></P> <P > '获取ArcMap的Application实例<p></p></P> <P > Set m_pApplication = hook<p></p></P> <P >End Sub<p></p></P> <P > <p></p></P> <P >Private Property Get ICommand_Tooltip() As String<p></p></P> <P > ICommand_Tooltip = " Create Button "<p></p></P> <P>End Property</P> |
|
|
1楼#
发布于:2006-10-08 16:33
<P>m_pApplication.Document针对arcmap的主体 </P>
<P>你使用map控件怕麻烦直接把imap传进来就可以</P> |
|
|
|
2楼#
发布于:2006-09-30 16:36
<P>楼主能把ArcGISBook.doc发给我吗?</P>
<P><a href="mailtzlj_ls@126.com" target="_blank" >zlj_ls@126.com</A></P> <P>非常感谢!</P><img src="images/post/smile/dvbbs/em02.gif" /> |
|
|
3楼#
发布于:2006-06-28 21:47
达人,帮忙啊!
|
|