You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects Visual Basic for Application (VBA) forum

make balloon callout hollow - Null Color   Linda McCafferty Oct 31, 2008
Re: make balloon callout hollow - Null Colo...   Neil Clemmons Oct 31, 2008
Re: make balloon callout hollow - Null Colo...   Linda McCafferty Oct 31, 2008
Re: make balloon callout hollow - Null Colo...   Linda McCafferty Oct 31, 2008
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject make balloon callout hollow - Null Color 
Author Linda McCafferty 
Date Oct 31, 2008 
Message Hello -

I'm hoping someone can help me figure out how to make the balloon callout background color hollow. I've tried using:
pBalloonCallout.Symbol.Color.NullColor = True but that doesn't seem to work.

Any help you could provide would be greatly appreciated.
 
 
Public Sub createBalloonlabels(ByVal pFeatureLayer As IFeatureLayer, _
                                ByVal strExpression As String)

  Dim pMxDocument As IMxDocument
  Dim pGeoFeatureLayer As IGeoFeatureLayer
  Dim pILabelEngineLayerProperties As ILabelEngineLayerProperties
  Dim pAnnotateLayerPropertiesCollection As IAnnotateLayerPropertiesCollection
  Dim pBasicOverposterLayerProperties4 As IBasicOverposterLayerProperties4
  Dim pAnnotateLayerProperties As IAnnotateLayerProperties
  Dim pFormattedTextSymbol As IFormattedTextSymbol
  Dim pTextSymbol As ITextSymbol
  Dim pCallout As ICallout
  Dim pBalloonCallout As IBalloonCallout
  Dim pColor As IRgbColor
  Dim pfont As IFontDisp

  Set pMxDocument = Application.Document
  
  ' Get label attributes from FeatureLayer.
  Set pGeoFeatureLayer = pFeatureLayer
  Set pAnnotateLayerPropertiesCollection = pGeoFeatureLayer.AnnotationProperties
  pAnnotateLayerPropertiesCollection.QueryItem 0, pAnnotateLayerProperties
  
  ' Transfer label expression to LabelEngine.
  Set pILabelEngineLayerProperties = pAnnotateLayerProperties
  pILabelEngineLayerProperties.Expression = strExpression
  
  ' Create Balloon Callout
  Set pCallout = New BalloonCallout
  Set pBalloonCallout = pCallout
  pBalloonCallout.Style = esriBCSRoundedRectangle
  
  'SETTING TEXT COLOR
  Set pColor = New RgbColor
  pColor.Red = 150
  pColor.Blue = 0
  pColor.Green = 0
     
  'SETTING TEXT FORMAT
  Set pfont = New StdFont
  pfont.Name = "Arial"
  pfont.Bold = False
  pfont.Size = 9
         
  Set pTextSymbol = New TextSymbol
  pTextSymbol.Color = pColor
  pTextSymbol.Font = pfont

  Set pFormattedTextSymbol = pTextSymbol
  pBalloonCallout.Symbol.Color.NullColor = True
  Set pCallout = pBalloonCallout
  Set pFormattedTextSymbol.Background = pCallout
  
  ' If user picked a text style (font, color, etc.) use it, otherwise use default.
  If Not pFormattedTextSymbol Is Nothing Then
    Set pILabelEngineLayerProperties.Symbol = pFormattedTextSymbol
  End If
 
  ' Force labels NOT to be placed inside polygons.
  Set pBasicOverposterLayerProperties4 = pILabelEngineLayerProperties.BasicOverposterLayerProperties
  pBasicOverposterLayerProperties4.PlaceOnlyInsidePolygon = False
  
  ' Turn on labeling and the layer.
  pGeoFeatureLayer.DisplayAnnotation = True
  pGeoFeatureLayer.Visible = True

  pMxDocument.ActiveView.Refresh

  Exit Sub

End Sub
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: make balloon callout hollow - Null Color 
Author Neil Clemmons 
Date Oct 31, 2008 
Message Most of the time you can't chain calls together like this:
pBalloonCallout.Symbol.Color.NullColor = True

The Symbol property could be returning a copy of the symbol object, so changing the color used by the copy will not affect the symbol used by the callout.

One thing you may try is to create a ISimpleFillSymbol object and set its Style to be Hollow. Use this symbol to set the FillSymbol property on your formatted text symbol object. 
  Neil Clemmons
Senior GIS Developer
Geographic Information Services, Inc.
Birmingham, AL
http://www.gis-services.com

Check out our blog:
http://blog.gis-services.com/ 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: make balloon callout hollow - Null Color 
Author Linda McCafferty 
Date Oct 31, 2008 
Message Thanks Neil - That's exactly what I needed.

If anyone is interested...here is the revised code, along with a graphic of what the balloon callouts look like.

Liinda 
 
Public Sub createBalloonlabels(ByVal pFeatureLayer As IFeatureLayer, _
                                ByVal strExpression As String)

  Dim pMxDocument As IMxDocument
  Dim pGeoFeatureLayer As IGeoFeatureLayer
  Dim pILabelEngineLayerProperties As ILabelEngineLayerProperties
  Dim pAnnotateLayerPropertiesCollection As IAnnotateLayerPropertiesCollection
  Dim pBasicOverposterLayerProperties4 As IBasicOverposterLayerProperties4
  Dim pAnnotateLayerProperties As IAnnotateLayerProperties
  Dim pFormattedTextSymbol As IFormattedTextSymbol
  Dim pTextSymbol As ITextSymbol
  Dim pCallout As ICallout
  Dim pBalloonCallout As IBalloonCallout
  Dim pColor As IRgbColor
  Dim pfont As IFontDisp

  Set pMxDocument = Application.Document
  
  ' Get label attributes from FeatureLayer.
  Set pGeoFeatureLayer = pFeatureLayer
  Set pAnnotateLayerPropertiesCollection = pGeoFeatureLayer.AnnotationProperties
  pAnnotateLayerPropertiesCollection.QueryItem 0, pAnnotateLayerProperties
  
  ' Transfer label expression to LabelEngine.
  Set pILabelEngineLayerProperties = pAnnotateLayerProperties
  pILabelEngineLayerProperties.Expression = strExpression
  
  Dim pSmplFill As ISimpleFillSymbol
  Set pSmplFill = New SimpleFillSymbol
  With pSmplFill
    .Style = esriSFSHollow
  End With
  
  Set pCallout = New BalloonCallout
  Set pBalloonCallout = pCallout
  pBalloonCallout.Style = esriBCSRoundedRectangle
  Set pBalloonCallout.Symbol = pSmplFill
  
  Set pColor = New RgbColor
  pColor.Red = 150
  pColor.Blue = 0
  pColor.Green = 0
     
  Set pfont = New StdFont
  pfont.Name = "Arial"
  pfont.Bold = False
  pfont.Size = 9
         
  Set pTextSymbol = New TextSymbol
  pTextSymbol.Color = pColor
  pTextSymbol.Font = pfont

  Set pFormattedTextSymbol = pTextSymbol
  Set pCallout = pBalloonCallout
  Set pFormattedTextSymbol.Background = pCallout
  Set pILabelEngineLayerProperties.Symbol = pFormattedTextSymbol
 
  ' Force labels NOT to be placed inside polygons.
  Set pBasicOverposterLayerProperties4 = pILabelEngineLayerProperties.BasicOverposterLayerProperties
  pBasicOverposterLayerProperties4.PlaceOnlyInsidePolygon = False
  
  ' Turn on labeling and the layer.
  pGeoFeatureLayer.DisplayAnnotation = True
  pGeoFeatureLayer.Visible = True

  pMxDocument.ActiveView.Refresh

  Exit Sub

End Sub
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: make balloon callout hollow - Null Color 
Author Linda McCafferty 
Date Oct 31, 2008 
Message Oops, I didn't hit the 'Attach File' button. Here's the graphic. 
  Hollow_Balloon_Callouts.bmp (opens in new window)