ArcObjects Library Reference

Create Line Callout Snippet

Create a default Line Callout by supplying the background fill, leaderline, and accentbar colors.

[C#]

///<summary>Create a default Line Callout by supplying  the background fill, leaderline, and accentbar colors.</summary>
///  
///<param name="backgroundRgbColor">An IRgbColor interface that is the background fill symbol color.</param>
///<param name="leaderlineRgbColor">An IRgbColor interface that is the line symbol color for the LeaderLine.</param>
///<param name="accentbarRgbColor">An IRgbColor intergace that is the line symbol color for the AccentBar.</param>
///   
///<returns>An ILineCallout interface.</returns>
///   
///<remarks></remarks>
public ESRI.ArcGIS.Display.ILineCallout CreateLineCallout(ESRI.ArcGIS.Display.IRgbColor backgroundRgbColor, ESRI.ArcGIS.Display.IRgbColor leaderLineRgbColor, ESRI.ArcGIS.Display.IRgbColor accentbarRgbColor)
{
  if(backgroundRgbColor == null || leaderLineRgbColor == null || accentbarRgbColor == null)
  {
    return null;
  }
  ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
  simpleFillSymbol.Color = backgroundRgbColor;
  simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid;

  ESRI.ArcGIS.Display.ISimpleLineSymbol leaderlineSimpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
  leaderlineSimpleLineSymbol.Color = leaderLineRgbColor;
  leaderlineSimpleLineSymbol.Width = 2;

  ESRI.ArcGIS.Display.ISimpleLineSymbol accentbarSimpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
  accentbarSimpleLineSymbol.Color = accentbarRgbColor;

  // Create the Callout
  ESRI.ArcGIS.Display.ILineCallout lineCallout = new ESRI.ArcGIS.Display.LineCalloutClass();
  lineCallout.Style = ESRI.ArcGIS.Display.esriLineCalloutStyle.esriLCSFourPoint;
  lineCallout.Border = simpleFillSymbol;
  lineCallout.AccentBar = accentbarSimpleLineSymbol;
  lineCallout.LeaderLine = leaderlineSimpleLineSymbol;

  return lineCallout;
}
[Visual Basic .NET]

'''<summary>Create a default Line Callout by supplying  the background fill, leaderline, and accentbar colors.</summary>
'''  
'''<param name="backgroundRgbColor">An IRgbColor interface that is the background fill symbol color.</param>
'''<param name="leaderlineRgbColor">An IRgbColor interface that is the line symbol color for the LeaderLine.</param>
'''<param name="accentbarRgbColor">An IRgbColor intergace that is the line symbol color for the AccentBar.</param>
'''   
'''<returns>An ILineCallout interface.</returns>
'''   
'''<remarks></remarks>
Public Function CreateLineCallout(ByVal backgroundRgbColor As ESRI.ArcGIS.Display.IRgbColor, ByVal leaderLineRgbColor As ESRI.ArcGIS.Display.IRgbColor, ByVal accentbarRgbColor As ESRI.ArcGIS.Display.IRgbColor) As ESRI.ArcGIS.Display.ILineCallout

  If backgroundRgbColor Is Nothing OrElse leaderLineRgbColor Is Nothing OrElse accentbarRgbColor Is Nothing Then
    Return Nothing
  End If

  Dim simpleFillSymbol As ESRI.ArcGIS.Display.ISimpleFillSymbol = New ESRI.ArcGIS.Display.SimpleFillSymbolClass
  simpleFillSymbol.Color = backgroundRgbColor
  simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid

  Dim leaderlineSimpleLineSymbol As ESRI.ArcGIS.Display.ISimpleLineSymbol = New ESRI.ArcGIS.Display.SimpleLineSymbolClass
  leaderlineSimpleLineSymbol.Color = leaderLineRgbColor
  leaderlineSimpleLineSymbol.Width = 2

  Dim accentbarSimpleLineSymbol As ESRI.ArcGIS.Display.ISimpleLineSymbol = New ESRI.ArcGIS.Display.SimpleLineSymbolClass
  accentbarSimpleLineSymbol.Color = accentbarRgbColor

  ' Create the Callout
  Dim lineCallout As ESRI.ArcGIS.Display.ILineCallout = New ESRI.ArcGIS.Display.LineCalloutClass
  With lineCallout
    .Style = ESRI.ArcGIS.Display.esriLineCalloutStyle.esriLCSFourPoint
    .Border = simpleFillSymbol
    .AccentBar = accentbarSimpleLineSymbol
    .LeaderLine = leaderlineSimpleLineSymbol
  End With

  Return lineCallout

End Function


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Display
  • ESRI.ArcGIS.System