ArcObjects Library Reference (Carto)  

IPageDescription.CustomGraphics Property

Custom graphics on the page.

[Visual Basic .NET]
Public Property CustomGraphics As IGraphicElements
[C#]
public IGraphicElements CustomGraphics {get; set;}
[C++]
HRESULT get_CustomGraphics(
  IGraphicElements** Elements
);
[C++]
HRESULT put_CustomGraphics(
  IGraphicElements* Elements
);
[C++]

Parameters

Elements [out, retval]

  Elements is a parameter of type IGraphicElements

Elements [in]

  Elements is a parameter of type IGraphicElements

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

Use CustomGraphics to add dynamic text or graphics to the exported layout. One common use of CustomGraphics is to add a customizable, dynamic title to each result of an ExportLayout request.

[C#]

The following sample code shows how to add custom text to your layout. It assumes that you already have a valid PageDescription object and that you are not working with a server context. However, if you are developing an ArcGIS for Server application using a server context, you should not use New to create local ArcObjects, but you should always create objects within the server by calling CreateObject on IServerContext.

IPageDescription pageDesc;

// Create text symbol
ITextSymbol textSymbol = new TextSymbolClass();

// Set Color
IRgbColor color = new RgbColorClass();
color.Blue = 255;
color.UseWindowsDithering = true;
textSymbol.Color = color;

// Set Font 
IFontDisp font = (IFontDisp)new stdole.StdFont();
font.Name = "Verdana";
font.Size = 20;
textSymbol.Font = font;

// Create text element
ITextElement textElement = new TextElementClass();
textElement.Text = "Custom Text";
textElement.Symbol = textSymbol;

// Set position
IPoint point = new PointClass();
point.X = 2.5;
point.Y = 1.5;
IElement element = (IElement)textElement;
element.Geometry = point;

// Create custom graphics
IGraphicElements custGraphics = new GraphicElementsClass();
custGraphics.Add((IGraphicElement)textElement);

// Add custom graphics to PageDescription
pageDesc.CustomGraphics = custGraphics;

See Also

IPageDescription Interface