This document is archived and information here might be outdated.  Recommended version.


How to make a line callout (ArcObjects .NET 10.4 SDK)

How to make a line callout


Summary
This topic shows how to make a line callout; however, it does not show how to apply the callout to a feature dataset.

Making a line callout

Line callouts provide a background for text that can be linked by a line to an anchor point. The symbols used for the leader line, accent bar, and border can be changed to suit the specific needs of the application for the callout.
Do the following basic steps to create a line callout:
  1. Create the background fill symbol.
  2. Create the line symbol used as the leader line.
  3. Create the line symbol used as the accent bar.
  4. Create the callout.
See the following code example:
[VB.NET]
Public Sub LineCallout()
    ' Create the background fill symbol.
    Dim backgroundRgbColorCls As ESRI.ArcGIS.Display.IRgbColor=New ESRI.ArcGIS.Display.RgbColorClass
    backgroundRgbColorCls.Red=255
    Dim simpleFillSymbolCls As ESRI.ArcGIS.Display.ISimpleFillSymbol=New ESRI.ArcGIS.Display.SimpleFillSymbolClass
    With simpleFillSymbolCls
        .Color=backgroundRgbColorCls
        .Style=ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid
    End With
    
    ' Create the line symbol used as the leader line.
    Dim leaderlineRgbColorCls As ESRI.ArcGIS.Display.IRgbColor=New ESRI.ArcGIS.Display.RgbColorClass
    leaderlineRgbColorCls.Blue=255
    Dim leaderlineSimpleLineSymbolCls As ESRI.ArcGIS.Display.ISimpleLineSymbol=New ESRI.ArcGIS.Display.SimpleLineSymbolClass
    With leaderlineSimpleLineSymbolCls
        .Color=leaderlineRgbColorCls
        .Width=2
    End With
    
    ' Create the line symbol used as the accent bar.
    Dim accentbarRgbColorCls As ESRI.ArcGIS.Display.IRgbColor=New ESRI.ArcGIS.Display.RgbColorClass
    accentbarRgbColorCls.Green=255
    Dim accentbarSimpleLineSymbolCls As ESRI.ArcGIS.Display.ISimpleLineSymbol=New ESRI.ArcGIS.Display.SimpleLineSymbolClass
    With accentbarSimpleLineSymbolCls
        .Color=accentbarRgbColorCls
    End With
    
    ' Create the callout.
    Dim lineCalloutCls As ESRI.ArcGIS.Display.ILineCallout=New ESRI.ArcGIS.Display.LineCalloutClass
    With lineCalloutCls
        .Style=ESRI.ArcGIS.Display.esriLineCalloutStyle.esriLCSFourPoint
        .Border=simpleFillSymbolCls
        .AccentBar=accentbarSimpleLineSymbolCls
        .LeaderLine=leaderlineSimpleLineSymbolCls
    End With
    
End Sub
[C#]
public void LineCallout()
{
    // Create the background fill symbol.
    ESRI.ArcGIS.Display.IRgbColor backgroundRgbColorCls=new
        ESRI.ArcGIS.Display.RgbColorClass();
    backgroundRgbColorCls.Red=255;
    ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbolCls=new
        ESRI.ArcGIS.Display.SimpleFillSymbolClass();
    simpleFillSymbolCls.Color=backgroundRgbColorCls;
    simpleFillSymbolCls.Style=ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid;

    // Create the line symbol used as the leader line.
    ESRI.ArcGIS.Display.IRgbColor leaderlineRgbColorCls=new
        ESRI.ArcGIS.Display.RgbColorClass();
    leaderlineRgbColorCls.Blue=255;
    ESRI.ArcGIS.Display.ISimpleLineSymbol leaderlineSimpleLineSymbolCls=new
        ESRI.ArcGIS.Display.SimpleLineSymbolClass();
    leaderlineSimpleLineSymbolCls.Color=leaderlineRgbColorCls;
    leaderlineSimpleLineSymbolCls.Width=2;

    // Create the line symbol used as the accent bar.
    ESRI.ArcGIS.Display.IRgbColor accentbarRgbColorCls=new
        ESRI.ArcGIS.Display.RgbColorClass();
    accentbarRgbColorCls.Green=255;
    ESRI.ArcGIS.Display.ISimpleLineSymbol accentbarSimpleLineSymbolCls=new
        ESRI.ArcGIS.Display.SimpleLineSymbolClass();
    accentbarSimpleLineSymbolCls.Color=accentbarRgbColorCls;

    // Create the callout.
    ESRI.ArcGIS.Display.ILineCallout lineCalloutCls=new
        ESRI.ArcGIS.Display.LineCalloutClass();
    lineCalloutCls.Style=ESRI.ArcGIS.Display.esriLineCalloutStyle.esriLCSFourPoint;
    lineCalloutCls.Border=simpleFillSymbolCls;
    lineCalloutCls.AccentBar=accentbarSimpleLineSymbolCls;
    lineCalloutCls.LeaderLine=leaderlineSimpleLineSymbolCls;
}


See Also:

How to make a cartographic line symbol
How to make a character marker symbol
How to make a gradient fill symbol
How to make a line fill symbol
How to make a picture marker symbol
Creating custom symbols
Creating other kinds of custom symbols
How to make different types of colors and color ramps




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine