阅读:1683回复:3
由ILayer怎样得到它Extent?先谢谢各位!!!
由ILayer怎样得到它Extent?先谢谢各位!!!
|
|
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> |
|
|
2楼#
发布于:2005-12-28 17:11
Thank you ,gis.<img src="images/post/smile/dvbbs/em05.gif" />
|
|
3楼#
发布于:2005-12-31 09:02
Dim pGeoDataset As IGeoDataset<BR>Set pGeoDataset = pLayer
|
|
|