ArcObjects Library Reference (Display)  

IDynamicGlyphFactory2.CreateDynamicGlyphFromBitmap Method

Create a dynamic glyph from a bitmap handle.

[Visual Basic .NET]
Public Function CreateDynamicGlyphFromBitmap ( _
    ByVal GlyphType As esriDynamicGlyphType, _
    ByVal hBmp As Integer, _
    ByVal preserveAlphaChannel As Boolean, _
    ByVal transparencyColor As IColor _
) As IDynamicGlyph
[C#]
public IDynamicGlyph CreateDynamicGlyphFromBitmap (
    esriDynamicGlyphType GlyphType,
    int hBmp,
    bool preserveAlphaChannel,
    IColor transparencyColor
);
[C++]
HRESULT CreateDynamicGlyphFromBitmap(
  esriDynamicGlyphType GlyphType,
  long hBmp,
  VARIANT_BOOL preserveAlphaChannel,
  IColor* transparencyColor,
  IDynamicGlyph** glyph
);
[C++]

Parameters

GlyphType [in]

  GlyphType is a parameter of type esriDynamicGlyphType

hBmp [in]   hBmp is a parameter of type long preserveAlphaChannel [in]   preserveAlphaChannel is a parameter of type VARIANT_BOOL transparencyColor [in]

  transparencyColor is a parameter of type IColor

glyph [out, retval]

  glyph is a parameter of type IDynamicGlyph

Product Availability

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

Remarks

Creates a dynamic glyph from a handle to a bitmap. If preserveAlphaChannel parameter is set, the method will honor the alpha values in the alpha channel, otherwise the alpha values will be set to to be opaque (255). If the transparency color parameter is not NULL, each pixel that matches the transparencyColor will be transparent (its alpha values in the glyph will be set to 0).

[C#]

The following code shows how to create a dynamic glyph from an embedded bitmap. It assumes that you already have valid DynamicGlyphFactory and DynamicGlyph objects, along with an embedded bitmap.

// Set the transparency color to be white
IColor transparenyColor =   Converter.ToRGBColor(Color.FromArgb(255,255, 255)) as IColor;
Bitmap bitmap = new Bitmap (GetType (), "B2.bmp");
// Create a marker glyph from embeded bitmap
m_markerGlyph =dynamicGlyphFactory.CreateDynamicGlyphFromBitmap(esriDynamicGlyphType.esriDGlyphMarker, bitmap.GetHbitmap ().ToInt32 (), false, transparencyColor);
[Visual Basic .NET]

The following code shows how to create a dynamic glyph from an embedded bitmap. It assumes that you already have valid DynamicGlyphFactory and DynamicGlyph objects, along with an embedded bitmap.

‘ Set the transparency color to be white
Dim transparenyColor As IColor = Converter.ToRGBColor(color.FromArgb(255, 255, 255))
Dim bitmap as new Bitmap(me.GetType(), "B2.bmp")
‘ Create a marker glyph from embeded bitmap
m_markerGlyph =  pDynamicGlyphFactory.CreateDynamicGlyphFromBitmap(esriDynamicGlyphType.esriDGlyphMarker,
bitmap.GetHbitmap.ToInt32(),False,transparenyColor)

See Also

IDynamicGlyphFactory2 Interface