This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Create Dynamic Marker Glyph from Image Snippet (ArcObjects .NET 10.4 SDK) |
Create a dynamic glyph for a marker symbol.
///<summary>Create a dynamic glyph for a marker symbol.</summary> /// ///<param name="dynamicGlyphFactory">An IDynamicGlyphFactory interface that is used to create the new glyph.</param> ///<param name="imagePath">A System.String that is the full path of the input image. Example: "C:\temp\myImage.jpg"</param> /// ///<returns>An IDynamicGlyph interface.</returns> /// ///<remarks>This method will create the glyph according to the image path.</remarks> public ESRI.ArcGIS.Display.IDynamicGlyph CreateDynamicMarkerGlyphFromImage(ESRI.ArcGIS.Display.IDynamicGlyphFactory dynamicGlyphFactory, System.String imagePath) { if (!System.IO.File.Exists(imagePath) || dynamicGlyphFactory == null) { return null; } // set black as the transparency color ESRI.ArcGIS.Display.IColor rgbColor=new ESRI.ArcGIS.Display.RgbColorClass(); rgbColor.RGB=0x0; // return a new marker glyph return dynamicGlyphFactory.CreateDynamicGlyphFromFile(ESRI.ArcGIS.Display.esriDynamicGlyphType.esriDGlyphMarker, imagePath, rgbColor); }
'''<summary>Create a dynamic glyph for a marker symbol.</summary> ''' '''<param name="dynamicGlyphFactory">An IDynamicGlyphFactory interface that is used to create the new glyph.</param> '''<param name="imagePath">A System.String that is the full path of the input image. Example: "C:\temp\myImage.jpg"</param> ''' '''<returns>An IDynamicGlyph interface.</returns> ''' '''<remarks>This method will create the glyph according to the image path.</remarks> Public Function CreateDynamicMarkerGlyphFromImage(ByVal dynamicGlyphFactory As ESRI.ArcGIS.Display.IDynamicGlyphFactory, ByVal imagePath As System.String) As ESRI.ArcGIS.Display.IDynamicGlyph If (Not System.IO.File.Exists(imagePath)) OrElse dynamicGlyphFactory Is Nothing Then Return Nothing End If ' set black as the transparency color Dim rgbColor As ESRI.ArcGIS.Display.IColor=New ESRI.ArcGIS.Display.RgbColorClass rgbColor.RGB=0 ' return a new marker glyph Return dynamicGlyphFactory.CreateDynamicGlyphFromFile(ESRI.ArcGIS.Display.esriDynamicGlyphType.esriDGlyphMarker, imagePath, rgbColor) End Function