How to create a line symbol


Use this function to create a simple line symbol. Line symbols are used when rendering linear features.

How to use

  1. Call this function optionally passing in a color, style, and width. The functionreturns an ISimpleLineSymbol.
[VBA]
Private Function CreateSimpleLineSymbol(Optional yourColor, _
                                        Optional yourStyle, _
                                        Optional yourWidth) As ISimpleLineSymbol
    Dim pSLS As ISimpleLineSymbol
    Set pSLS = New SimpleLineSymbol
    
    If Not IsMissing(yourColor) Then
        pSLS.color = yourColor
    End If
    
    If Not IsMissing(yourStyle) Then
        pSLS.style = yourStyle
    End If
    
    If Not IsMissing(yourWidth) Then
        pSLS.Width = yourWidth
    End If
    
    Set CreateSimpleLineSymbol = pSLS
End Function