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


How to make a picture marker symbol (ArcObjects .NET 10.5 SDK)

How to make a picture marker symbol


Summary
The code example in this topic shows how to create a picture marker symbol.

Making a picture marker symbol

A picture marker symbol can be created using either a Windows bitmap (BMP) or enhanced metafile (EMF) as the underlying artwork for the symbol. The following code shows an example for using both types of files as the input. You need to modify the input path for each type to point to the appropriate file.
[VB.NET]
Public Sub PictureMarkerSymbol()
    ' This example creates two picture marker symbols; one from a .emf file
    ' and one from a .bmp file.
    
    ' Set the transparent background color for the .bmp-based picture marker symbol to white.
    Dim rgbColorCls As ESRI.ArcGIS.Display.IRgbColor=New ESRI.ArcGIS.Display.RgbColorClass
    rgbColorCls.Red=255
    rgbColorCls.Green=255
    rgbColorCls.Blue=255
    
    ' Create the EMF marker and assign properties.
    Dim emfPictureMarkerSymbolCls As ESRI.ArcGIS.Display.IPictureMarkerSymbol=New ESRI.ArcGIS.Display.PictureMarkerSymbolClass
    With emfPictureMarkerSymbolCls
        .CreateMarkerSymbolFromFile(ESRI.ArcGIS.Display.esriIPictureType.esriIPictureEMF, "c:\temp\mypict.emf")
        .Angle=0
        .Size=24
        .XOffset=0
        .YOffset=0
    End With
    
    ' Create the bitmap marker and assign properties.
    Dim bitmapPictureMarkerSymbolCls As ESRI.ArcGIS.Display.IPictureMarkerSymbol=New ESRI.ArcGIS.Display.PictureMarkerSymbolClass
    With bitmapPictureMarkerSymbolCls
        .CreateMarkerSymbolFromFile(ESRI.ArcGIS.Display.esriIPictureType.esriIPictureBitmap, "c:\temp\mypict.bmp")
        .Angle=0
        .BitmapTransparencyColor=rgbColorCls
        .Size=32
        .XOffset=0
        .YOffset=0
    End With
    
End Sub
[C#]
public void PictureMarkerSymbol()
{
    // This example creates two picture marker symbols; one from a .emf file and 
    // one from a .bmp file.

    // Set the transparent background color for the .bmp-based picture marker symbol to white.
    ESRI.ArcGIS.Display.IRgbColor rgbColorCls=new
        ESRI.ArcGIS.Display.RgbColorClass();
    rgbColorCls.Red=255;
    rgbColorCls.Green=255;
    rgbColorCls.Blue=255;

    // Create the EMF marker and assign properties.
    ESRI.ArcGIS.Display.IPictureMarkerSymbol emfPictureMarkerSymbolCls=new
        ESRI.ArcGIS.Display.PictureMarkerSymbolClass();
    emfPictureMarkerSymbolCls.CreateMarkerSymbolFromFile
        (ESRI.ArcGIS.Display.esriIPictureType.esriIPictureEMF, 
        "c:\\temp\\mypict.emf");
    emfPictureMarkerSymbolCls.Angle=0;
    emfPictureMarkerSymbolCls.Size=24;
    emfPictureMarkerSymbolCls.XOffset=0;
    emfPictureMarkerSymbolCls.YOffset=0;

    // Create the bitmap marker and assign properties.
    ESRI.ArcGIS.Display.IPictureMarkerSymbol bitmapPictureMarkerSymbolCls=new
        ESRI.ArcGIS.Display.PictureMarkerSymbolClass();
    bitmapPictureMarkerSymbolCls.CreateMarkerSymbolFromFile
        (ESRI.ArcGIS.Display.esriIPictureType.esriIPictureBitmap, 
        "c:\\temp\\mypict.bmp");
    bitmapPictureMarkerSymbolCls.Angle=0;
    bitmapPictureMarkerSymbolCls.BitmapTransparencyColor=rgbColorCls;
    bitmapPictureMarkerSymbolCls.Size=32;
    bitmapPictureMarkerSymbolCls.XOffset=0;
    bitmapPictureMarkerSymbolCls.YOffset=0;
}


See Also:

How to make a cartographic line symbol
How to make a character marker symbol
How to make a gradient fill symbol
How to make a line callout
How to make a line fill symbol
Creating custom symbols
Creating other kinds of custom symbols
How to make different types of colors and color ramps




Development licensing Deployment licensing
ArcGIS Desktop Basic ArcGIS Desktop Basic
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
Engine Developer Kit Engine