In case somebody is looking at the same, I solved this with a procedure creating the categories (VBA):
Now after creating the shapefile I call the function with the variables holding my shapefile and the number of colours I want (NrColors). Every shape will now get a category by the following:
Sub CreateLineColors(sf as MapWINGIS.Shapefile, aantal As Integer)
Dim ct As MapWinGIS.ShapefileCategory
Dim i As Integer
For i = 0 To aantal - 1
Set ct = sf.Categories.Add("Kleur" & i)
ct.DrawingOptions.LineColor = RGB(RandomColor(225), RandomColor(225), RandomColor(225))
ct.DrawingOptions.LineWidth = 3
Next i
End Sub
Function RandomColor(MaxValue As Integer) As Integer
RandomColor = Int((MaxValue * Rnd) + 1)
End Function
(because I don't want almost white colours I maximized the values to 225)Now after creating the shapefile I call the function with the variables holding my shapefile and the number of colours I want (NrColors). Every shape will now get a category by the following:
shpIndex = sf.EditAddShape(shp)
If shpIndex = -1 Then
'Something goes wrong!
Else
sf.ShapeCategory(shpIndex) = shpIndex Mod NrColors
End If