tree
路人甲
路人甲
  • 注册日期2005-01-28
  • 发帖数28
  • QQ
  • 铜币287枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1626回复:3

下面代码中LabelWhichFeatures属性设置为何不起作用

楼主#
更多 发布于:2006-03-31 11:17
<P>要标注被选中的要素地物,设置IAnnotateLayerProperties接口LabelWhichFeatures属性值为esriSelectedFeatures,可是不起作用。</P>
<P>代码如下:</P>
<P>Public Sub LabelPoint(pRect As esriCore.IEnvelope)<br>    '///<br>    On Error GoTo myErr<br>    '////<br>    Dim i As Long<br>    Dim pFeatureLayer As IFeatureLayer<br>    Dim pSpliter As esriCore.ISpatialFilter<br>    Dim pFeature As esriCore.ifeature<br>    Dim b As Boolean<br>    Dim iCurSor As esriCore.IFeatureCursor<br>    <br>    Set pSpliter = New esriCore.SpatialFilter<br>    pSpliter.SpatialRel = esriSpatialRelContains<br>    Set pSpliter.Geometry = pRect<br>    b = False<br>  <br>    frmMain.Map1.map.SelectByShape pRect, Nothing, True<br>    Dim iFSEL As IFeatureSelection<br>    '///遍历图层<br>    For i = 0 To frmMain.Map1.map.LayerCount - 1<br>        Set pFeatureLayer = frmMain.Map1.map.layer(i)<br>        If InStr(1, pFeatureLayer.Name, "管点") > 0 Then<br>             Set iFSEL = pFeatureLayer<br>             If iFSEL.SelectionSet.Count > 0 Then<br>                b = True<br>                Exit For<br>             End If<br>        End If<br>    Next<br>    If b = False Then<br>        MsgBox "您没有选中管点!", vbInformation, "标注管点"<br>        GoTo There<br>    End If<br>        <br>    <br>    Dim pGeoFeatureLayer As esriCore.IGeoFeatureLayer<br>    Set pGeoFeatureLayer = pFeatureLayer<br>    Dim pALPC As esriCore.IAnnotateLayerPropertiesCollection<br>    Set pALPC = New esriCore.AnnotateLayerPropertiesCollection<br>    Dim pALP As esriCore.IAnnotateLayerProperties<br>    Set pALP = New esriCore.LabelEngineLayerProperties<br>    Dim pLELP As esriCore.ILabelEngineLayerProperties<br>    Set pLELP = New esriCore.LabelEngineLayerProperties<br>    Dim pGC As IGraphicsContainer<br>    Set pGC = frmMain.Map1.map<br>    With pALP<br>        .LabelWhichFeatures = esriSelectedFeatures   '???????????????????????????????????????????????///不起作用?<br>        .AnnotationMaximumScale = 0<br>        .AnnotationMinimumScale = 10000<br>    End With<br>    Set pLELP = pALP<br>    With pLELP<br>        .Expression = "[地面高程]"<br>    End With<br>    pALPC.Add pLELP<br>    pGeoFeatureLayer.AnnotationProperties = pALPC<br>    pGeoFeatureLayer.DisplayAnnotation = True<br>There:<br>    frmMain.Map1.map.ClearSelection<br>    mLayerDraw = CNOTHING<br>    frmMain.Map1.Refresh<br>    '///清理变量、对象<br>    Set pFeatureLayer = Nothing<br>    Set pSpliter = Nothing<br>    Set ifeature = Nothing<br>    Set iCurSor = Nothing<br>    Set iFSEL = Nothing<br>    Set pGeoFeatureLayer = Nothing<br>    Set pALPC = Nothing<br>    Set pALP = Nothing<br>    Set pLELP = Nothing<br>    Exit Sub<br>myErr:<br>    Call ErrMsg<br>End Sub</P>
<P>程序运行结果是pFeatureLayer层中的所有地物均被标注上了。是不是属性设置不对,大家帮忙找找原因。</P><br><img src="images/post/smile/dvbbs/em30.gif" />
[此贴子已经被作者于2006-3-31 11:28:43编辑过]
喜欢0 评分0
tree
路人甲
路人甲
  • 注册日期2005-01-28
  • 发帖数28
  • QQ
  • 铜币287枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-04-11 15:54
<img src="images/post/smile/dvbbs/em50.gif" />
举报 回复(0) 喜欢(0)     评分
万里云
路人甲
路人甲
  • 注册日期2005-01-14
  • 发帖数114
  • QQ
  • 铜币414枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-04-04 15:38
<P>忘记了</P>
[此贴子已经被作者于2006-4-4 15:42:22编辑过]
女口果人尔能看日月白这段言舌,那言兑日月人尔白勺目艮目青有严重白勺散光 
举报 回复(0) 喜欢(0)     评分
tree
路人甲
路人甲
  • 注册日期2005-01-28
  • 发帖数28
  • QQ
  • 铜币287枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-04-03 13:38
<P>大家帮忙看看</P>
<P>着急</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部