Select to view content in your preferred language

How to set icon size programmatically?

829
1
10-29-2012 08:16 AM
salmanasad
New Contributor
I am using ArcGIS Engine with c# .Net. I want to set the icon size, text size, text style of plotted item. I want to do this programmatically.
0 Kudos
1 Reply
DavidClarke1
Occasional Contributor
This is VB.NET but you should be able to translate.

One way I create text labels this way:

        Dim Text As ESRI.ArcGIS.Display.ISimpleTextSymbol = New ESRI.ArcGIS.Display.TextSymbol
        Dim esriColor As ESRI.ArcGIS.Display.IRgbColor = New ESRI.ArcGIS.Display.RgbColor
        Dim fntDisp As stdole.IFontDisp

        esriColor.Red = 0
        esriColor.Blue = 0
        esriColor.Green = 0
       
        fntDisp = New stdole.StdFont

        With fntDisp
            .Name = "Arial"
            .Bold = false
            .Italic = false
            .Strikethrough = false
            .Underline = false
            .Size = 15
        End With

        Text.Font = fntDisp
        Text.Color = esriColor


To create symbols I use the "Size" property of the IPictureMarkerSymbol, ICharacterMarkerSymbol, or ISimpleMarkerSymbol.  Here is an example.


    Public Function CreateSimpleMarker() As ESRI.ArcGIS.Display.ISimpleMarkerSymbol

        Dim Clr As ESRI.ArcGIS.Display.IRgbColor = New ESRI.ArcGIS.Display.RgbColorClass
        With Clr
            .Red = 255
            .Green = 0
            .Blue = 0
        End With

        Dim SimpleSymbol As ESRI.ArcGIS.Display.ISimpleMarkerSymbol
        SimpleSymbol = New ESRI.ArcGIS.Display.SimpleMarkerSymbolClass

        With SimpleSymbol
            .Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle
            .Size = 10
            .Color = Clr
            .XOffset = 0
            .YOffset = 0
        End With

        Return SimpleSymbol

    End Function
0 Kudos