sirc_lizheng
伴读书童
伴读书童
  • 注册日期2004-07-09
  • 发帖数148
  • QQ
  • 铜币495枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2278回复:8

关于添加layer的代码问题!

楼主#
更多 发布于:2005-09-10 10:55
<P>总统先生和各位高手:我有下面的类代码(clsaddlayer):</P>
<P>'<BR>Option Explicit</P>
<P>Dim m_pApp As IApplication</P>
<P>Implements ICommand<BR> <BR>Private Property Get ICommand_Enabled() As Boolean<BR>  ICommand_Enabled = True<BR>End Property<BR> <BR>Private Property Get ICommand_Checked() As Boolean<BR>  ' TOD Add your implementation here<BR>End Property<BR> <BR>Private Property Get ICommand_Name() As String<BR>  ICommand_Name = "Developer Samples_Add Custom Layer"<BR>End Property<BR> <BR>Private Property Get ICommand_Caption() As String<BR>  ICommand_Caption = "Add Custom Layer"<BR>End Property<BR> <BR>Private Property Get ICommand_Tooltip() As String<BR>  ICommand_Tooltip = "Add Custom Layer To Map"<BR>End Property<BR> <BR>Private Property Get ICommand_Message() As String<BR>  ICommand_Message = "Add a Custom Layer to the Map"<BR>End Property<BR> <BR>Private Property Get ICommand_HelpFile() As String<BR>  <BR>  ' TOD Add your implementation here<BR>  <BR>End Property<BR> <BR>Private Property Get ICommand_HelpContextID() As Long<BR>  ' TOD Add your implementation here<BR>End Property<BR> <BR>Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE<BR>  ' TOD Add your implementation here<BR>End Property<BR> <BR>Private Property Get ICommand_Category() As String<BR>  ICommand_Category = "Developer Samples"<BR>End Property<BR> <BR>Private Sub ICommand_OnCreate(ByVal hook As Object)<BR>  Set m_pApp = hook<BR>End Sub<BR> <BR>Private Sub ICommand_OnClick()<BR>  Dim pCustomLayer As CUSTOMLAYERSLib.ICustomLayer<BR>  Set pCustomLayer = New CUSTOMLAYERSLib.CustomLayer<BR>  <BR>  Dim pMxDoc As IMxDocument<BR>  Set pMxDoc = m_pApp.Document‘运行时有问题<BR>  <BR>  Dim pLayer As ILayer<BR>  Set pLayer = pCustomLayer<BR>  pLayer.Name = "Test Custom Layer"<BR>  <BR>  pMxDoc.FocusMap.addlayer pCustomLayer<BR>End Sub</P>
<P>Public Sub addlayer()<BR>    ICommand_OnClick<BR>End Sub</P>
<P><BR>然后定义对象</P>
<P>public iii as clsaddlayer</P>
<P>iii.addlayer</P>
<P>但运行时,出现Set pMxDoc = m_pApp.Document没有定义,什么with之类的错误!</P>
<P>请总统先生赐教!谢谢!</P>
喜欢0 评分0
sirc_lizheng
伴读书童
伴读书童
  • 注册日期2004-07-09
  • 发帖数148
  • QQ
  • 铜币495枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-09-12 14:54
<P>谢谢大家的知道,看来我搞错了。</P>
<P>怎样修改可以变成AE的代码呢?</P>
举报 回复(0) 喜欢(0)     评分
sirc_lizheng
伴读书童
伴读书童
  • 注册日期2004-07-09
  • 发帖数148
  • QQ
  • 铜币495枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-09-13 13:13
<P>谢谢你,我会尽快试试看,然后反映情况,你是个好人!</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部