Categories Line

Hello
I tried create categories for lines but i cant paint with diferentes colors, somebody help me with a example, i want use the fieldindex categoria from my dbf for generate categories.
Thanks.

Hello @Luis

You can try something like (in VB.NET):

    Dim utils As New Utils()

    Dim cat As ShapefileCategory = sf.Categories.Add("Cat459")
    cat.ValueType = tkCategoryValue.cvExpression
    cat.Expression = "[Categoria] = 459"
    Dim options As ShapeDrawingOptions = cat.DrawingOptions
    With options
        .Visible = True
        .LineColor = utils.ColorByName(tkMapColor.Blue)
        .LineWidth = 2
    End With

    cat As ShapefileCategory = sf.Categories.Add("Cat554")
    cat.ValueType = tkCategoryValue.cvExpression
    cat.Expression = "[Categoria] = 554"
    options As ShapeDrawingOptions = cat.DrawingOptions
    With options
        .Visible = True
        .LineColor = utils.ColorByName(tkMapColor.Red)
        .LineWidth = 2
    End With

    sf.Categories.ApplyExpressions()

Regards,
Jerry.

1 Like

Thanks so much Jerry :smiley:

This helped me too Jerry, thanks a lot!