This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Display > ESRI.ArcGIS.Display > Interfaces > ID > IDynamicGlyphFactory Interface > IDynamicGlyphFactory.CreateDynamicGlyph Method (ArcObjects .NET 10.4 SDK) |
Creates a dynamic glyph from a symbol.
[Visual Basic .NET] Public Function CreateDynamicGlyph ( _ ByVal Symbol As ISymbol _ ) As IDynamicGlyph
[C#] public IDynamicGlyph CreateDynamicGlyph ( ISymbol Symbol );
[C++]
HRESULT CreateDynamicGlyph(
ISymbol* Symbol,
IDynamicGlyph** glyph
);
[C++]
Parameters Symbol [in]
Symbol is a parameter of type ISymbol glyph [out, retval]
glyph is a parameter of type IDynamicGlyph
For monochromatic symbols (symbols that consist of only one color and might even have fixed black pixels), it is advisable to set the Symbol color to white before passing it into the method. When rendering the Dynamic Symbol, using the Dynamic Glyph created using this method, you should then set the color to the desired color. That will result in coloring the white pixels to the desired color, while leaving the black colors black.
The following code shows how to create a dynamic glyph from a character marker symbol. It assumes that you already have valid DynamicGlyphFactory and DynamicGlyph objects.
// create character marker Symbol
ICharacterMarkerSymbol characterMarkerSymbol=new CharacterMarkerSymbolClass();
// set the symbol color to be white
characterMarkerSymbol.Color= Converter.ToRGBColor(Color.FromArgb(255, 255, 255)) as IColor;
characterMarkerSymbol.Font=Converter.ToStdFont (new Font ("ESRI Environmental & Icons",32));
characterMarkerSymbol.Size=40;
characterMarkerSymbol.Angle=0;
characterMarkerSymbol.CharacterIndex=36;
// create the glyph from the character marker symbol
m_markerGlyph=dynamicGlyphFactory.CreateDynamicGlyph(characterMarkerSymbol as ISymbol);
The following code shows how to create a dynamic glyph from a character marker symbol. It assumes that you already have valid DynamicGlyphFactory and DynamicGlyph objects.
' create character marker Symbol
Dim characterMarkerSymbol As ICharacterMarkerSymbol=New CharacterMarkerSymbolClass()
' set the symbol color to be white
characterMarkerSymbol.Color TryCast(Converter.ToRGBColor(color.FromArgb(255, 255, 255)), IColor)
characterMarkerSymbol.Font=Converter.ToStdFont(new Font("ESRI Environmental & Icons", 32))
characterMarkerSymbol.Size=40
characterMarkerSymbol.Angle=0
characterMarkerSymbol.CharacterIndex=36
' create the glyph from the character marker symbol
m_markerGlyph= dynamicGlyphFactory.CreateDynamicGlyph(TryCas(characterMarkerSymbol, ISymbol))