This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IP > IPageDescription Interface > IPageDescription.CustomGraphics Property (ArcObjects .NET 10.4 SDK) |
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
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.
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;