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


IDynamicSymbolProperties.SetColor Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Display)  

IDynamicSymbolProperties.SetColor Method

Indicates the color for the specified dynamic symbol.

[Visual Basic .NET]
Public Sub SetColor ( _
    ByVal dynamicSymbolType As esriDynamicSymbolType, _
    ByVal Red As Single, _
    ByVal Green As Single, _
    ByVal Blue As Single, _
    ByVal alpha As Single _
)
[C#]
public void SetColor (
    esriDynamicSymbolType dynamicSymbolType,
    float Red,
    float Green,
    float Blue,
    float alpha
);
[C++]
HRESULT SetColor(
  esriDynamicSymbolType dynamicSymbolType,
  float Red,
  float Green,
  float Blue,
  float alpha
);
[C++]

Parameters dynamicSymbolType [in]
dynamicSymbolType is a parameter of type esriDynamicSymbolType Red [in] Red is a parameter of type float Green [in] Green is a parameter of type float Blue [in] Blue is a parameter of type float alpha [in] alpha is a parameter of type float

Product Availability

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

Remarks

The color attribute can be used in order to reuse a glyph, and render it in different colors, if possible, rather than creating a different glyph for each color. This is recommended in order to minimize graphic resources usage, and is possible with monochromatic symbols.

For monochromatic symbols (symbols that consist of only one color and might even have fixed black pixels), it is advisable to create a white-and-black dynamic glyph, and then set the DynamicSymbol’s color to the desired color. That will result in coloring the white pixels to the desired color, while leaving the black colors black. That method enables you to reuse a white-and-black glyph to draw different colors of the same glyph.

For multicolor symbols (symbols that contain more than just white and black colors in them), it is advisable to create the multicolor glyph, and then set the DynamicSymbol’s color to white. That will result in rendering the original colors of the glyph’s pixels.Use the alpha value in order to affect the Dynamic Symbol’s transparency level.

The target pixel color is being calculated by multiplying the Glyph’s color value with the value of the Color Property. For example - a white opaque color (R=1, G=1, B=1, A=1) will result in rendering the pixels with the original glyph’s color values, with the same transparency level.

See Also

IDynamicSymbolProperties Interface

.NET Snippets

Draw Compound Marker on Dynamic Display

.NET Samples

Dynamic biking (Code Files: DynamicBikingCmd) | Dynamic display�tracking dynamic object (Code Files: TrackObject)