电光火石
路人甲
路人甲
  • 注册日期2004-09-03
  • 发帖数70
  • QQ
  • 铜币366枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2037回复:6

用数据库的某个字段做标注时出现了错误

楼主#
更多 发布于:2005-04-05 23:34
<P>我不能更改其默认的标注字段,请问怎么改掉其默认的字段</P>
<P>Public Sub FunAnnotation(ByVal pFieldName As String)
  
   Dim pFeatureLayer As IFeatureLayer
   Dim pFeatureClass As IFeatureClass
   Dim pGeoFeatureLayer As IGeoFeatureLayer
   Dim pActiveView As IActiveView
  
   Dim pAnnotateLayerPropertiesCollection As IAnnotateLayerPropertiesCollection
   Dim pAnnotateLayerProperties As IAnnotateLayerProperties
  
   Set pActiveView = pMap
  
   ' 判断是否可以开始编辑
   If pCurrentLayer Is Nothing Then Exit Sub
   If Not TypeOf pCurrentLayer Is IGeoFeatureLayer Then Exit Sub
   Set pFeatureLayer = pCurrentLayer</P>
<P>   Set pGeoFeatureLayer = pFeatureLayer
  
   pGeoFeatureLayer.DisplayField = pFieldName
  
   MsgBox pGeoFeatureLayer.DisplayField
  
   Set pAnnotateLayerPropertiesCollection = pGeoFeatureLayer.AnnotationProperties
   pAnnotateLayerPropertiesCollection.QueryItem 0, pAnnotateLayerProperties, Nothing, Nothing
  
'   pAnnotateLayerProperties.DisplayAnnotation = True
  
   pGeoFeatureLayer.DisplayAnnotation = True</P>
<P>   pActiveView.Refresh
End Sub</P>
喜欢0 评分0
万里云
路人甲
路人甲
  • 注册日期2005-01-14
  • 发帖数114
  • QQ
  • 铜币414枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-04-06 15:34
我也在刚开始做标注,关注中......
女口果人尔能看日月白这段言舌,那言兑日月人尔白勺目艮目青有严重白勺散光 
举报 回复(0) 喜欢(0)     评分
fnwgz
伴读书童
伴读书童
  • 注册日期2004-09-16
  • 发帖数120
  • QQ
  • 铜币638枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-04-23 06:42
关注中......
我也许很笨,但是我一直再努力,没有放弃!
举报 回复(0) 喜欢(0)     评分
wavvylia
路人甲
路人甲
  • 注册日期2003-07-28
  • 发帖数384
  • QQ
  • 铜币555枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-04-26 14:43
我用在标注某个字段时,经常不稳定,常常导致VB崩溃。
举报 回复(0) 喜欢(0)     评分
pearlstar
路人甲
路人甲
  • 注册日期2004-07-11
  • 发帖数92
  • QQ
  • 铜币160枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2005-04-29 13:44
<DIV class=quote>应该加上 pAnnotateLayerPropertiesCollection.clear</DIV>
<DIV class=quote>因为pgeofeaturelayer有一个默认的注记设置,如果没有clear掉,就会重复显示</DIV>
<DIV class=quote>另外设置标注字段,需要用到的时LabelEngineLayerProperties的ILabelEngineLayerProperties这个接口,你查查帮助就知道了</DIV>
<DIV class=quote> </DIV>
<DIV class=quote><B>以下是引用<I>电光火石</I>在2005-4-5 23:34:00的发言:</B></DIV>

<P>我不能更改其默认的标注字段,请问怎么改掉其默认的字段</P>
<P>Public Sub FunAnnotation(ByVal pFieldName As String)
  
   Dim pFeatureLayer As IFeatureLayer
   Dim pFeatureClass As IFeatureClass
   Dim pGeoFeatureLayer As IGeoFeatureLayer
   Dim pActiveView As IActiveView
  
   Dim pAnnotateLayerPropertiesCollection As IAnnotateLayerPropertiesCollection
   Dim pAnnotateLayerProperties As IAnnotateLayerProperties
  
   Set pActiveView = pMap
  
   ' 判断是否可以开始编辑
   If pCurrentLayer Is Nothing Then Exit Sub
   If Not TypeOf pCurrentLayer Is IGeoFeatureLayer Then Exit Sub
   Set pFeatureLayer = pCurrentLayer</P>
<P>   Set pGeoFeatureLayer = pFeatureLayer
  
   pGeoFeatureLayer.DisplayField = pFieldName
  
   MsgBox pGeoFeatureLayer.DisplayField
  
   Set pAnnotateLayerPropertiesCollection = pGeoFeatureLayer.AnnotationProperties
   pAnnotateLayerPropertiesCollection.QueryItem 0, pAnnotateLayerProperties, Nothing, Nothing
  
'   pAnnotateLayerProperties.DisplayAnnotation = True
  
   pGeoFeatureLayer.DisplayAnnotation = True</P>
<P>   pActiveView.Refresh
End Sub</P>

举报 回复(0) 喜欢(0)     评分
老鳖
路人甲
路人甲
  • 注册日期2004-11-14
  • 发帖数61
  • QQ
  • 铜币287枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-05-09 16:43
<img src="images/post/smile/dvbbs/em01.gif" />
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
6楼#
发布于:2005-07-22 15:37
<P>CODE: <BR><BR>Public Sub AddStreetsLabels() <BR><BR>'Access current active view <BR>Dim pDoc As IMxDocument <BR>Set pDoc = ThisDocument <BR>Dim pMap As IMap <BR>Set pMap = pDoc.FocusMap <BR><BR>'Access the first layer in TOC <BR>Dim pLayer As IGeoFeatureLayer <BR>Set pLayer = pMap.Layer(0) <BR><BR>'Show Tool Tips for a field <BR>pLayer.DisplayField = "ADD_LO_ODD" <BR>pLayer.ShowTips = True <BR><BR>'Set font color <BR>Dim pColorFont As IRgbColor <BR>Set pColorFont = New RgbColor <BR>pColorFont.RGB = RGB(0, 0, 0) <BR><BR>'Set font type, size <BR>Dim pFont As IFontDisp <BR>Set pFont = New StdFont <BR>pFont.Name = "Verdana" <BR>pFont.Size = 4.2 <BR>pFont.Bold = False <BR><BR>'Define text symbol <BR>Dim pText As IFormattedTextSymbol <BR>Set pText = New TextSymbol <BR>pText.Font = pFont <BR>pText.Color = pColorFont <BR><BR>'Create new AnnotateLayerPropertiesCollection <BR>Dim pAnnoPropsCollection As IAnnotateLayerPropertiesCollection <BR>Set pAnnoPropsCollection = New AnnotateLayerPropertiesCollection <BR><BR>'Set up new LabelEngineLayerProperties <BR>Dim pLabelEngine As ILabelEngineLayerProperties <BR>Set pLabelEngine = New LabelEngineLayerProperties <BR>pLabelEngine.Expression = "[STRTNAME]" 'Attribute field to be labeled <BR>Set pLabelEngine.Symbol = pText 'Text symbol from pText <BR><BR>'Set AnnotateLayerProperties to the labels defined above <BR>Dim pAnnoLayerProps As IAnnotateLayerProperties <BR>Set pAnnoLayerProps = pLabelEngine <BR>pAnnoLayerProps.WhereClause = "(STRTNAME = 'KENDRICK CIR')" 'SQL clause <BR>determines <BR><BR>'what features are labeled <BR><BR>'Add AnnotateLayerProperties defined above to the <BR>'AnnotateLayersPropertiesCollection <BR>pAnnoPropsCollection.Add pAnnoLayerProps <BR><BR>'Set the current AnnotateLayerPropertiesCollection to <BR>'the layer's AnnotationProperties and display them <BR>pLayer.AnnotationProperties = pAnnoPropsCollection <BR>pLayer.DisplayAnnotation = True <BR><BR>pDoc.ActiveView.PartialRefresh esriDPGeography, pLayer, Nothing <BR>pDoc.UpdateContents <BR><BR>End Sub <BR></P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部