loveGisok
路人甲
路人甲
  • 注册日期2005-11-22
  • 发帖数16
  • QQ
  • 铜币156枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1683回复:3

由ILayer怎样得到它Extent?先谢谢各位!!!

楼主#
更多 发布于:2005-12-27 10:43
由ILayer怎样得到它Extent?先谢谢各位!!!
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-12-27 17:15
<STRONG>How to use:</STRONG>
<DIV>
<OL>
<LI>Paste the code into VBA.
<LI>Modify the code to get the desired layer.
<LI>Execute the routine. </LI></OL></DIV>
<DIV><PRE>          <DEVELOPENV>Public Sub ZoomToLayer()
  Dim pMxDoc As IMxDocument
  Dim pMap As IMap
  Dim pActiveView As IActiveView
  
  Set pMxDoc = Application.Document
  Set pMap = pMxDoc.FocusMap
  Set pActiveView = pMap
  
  If pMap.Layer(0) Is Nothing Then Exit Sub
  pActiveView.Extent = pMap.Layer(0).AreaOfInterest
  pActiveView.Refresh
End Sub


Public Sub ZoomToLayer2()
  Dim pMxDoc As IMxDocument
  Dim pMap As IMap
  Dim pActiveView As IActiveView
  Dim pContentsView As IContentsView
  Dim pLayer As ILayer
  
  Set pMxDoc = Application.Document
  Set pMap = pMxDoc.FocusMap
  Set pActiveView = pMap
  Set pContentsView = pMxDoc.CurrentContentsView
  
  If Not TypeOf pContentsView.SelectedItem Is ILayer Then Exit Sub
  Set pLayer = pContentsView.SelectedItem
  pActiveView.Extent = pLayer.AreaOfInterest
  pActiveView.Refresh
End Sub</DEVELOPENV>
</PRE></DIV>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
loveGisok
路人甲
路人甲
  • 注册日期2005-11-22
  • 发帖数16
  • QQ
  • 铜币156枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-12-28 17:11
Thank you ,gis.<img src="images/post/smile/dvbbs/em05.gif" />
举报 回复(0) 喜欢(0)     评分
zhousky
论坛版主
论坛版主
  • 注册日期2003-08-01
  • 发帖数281
  • QQ
  • 铜币1027枚
  • 威望3点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-12-31 09:02
Dim pGeoDataset As IGeoDataset<BR>Set pGeoDataset = pLayer
不要看我噢
举报 回复(0) 喜欢(0)     评分
游客

返回顶部