Hello Dimp, I try with your code in Vb (VS2013 in W7x64) but I can't see the labels, can you give and idea?.
When I watch the variable objText.labels I see "Labels = {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}"
The code is:
When I watch the variable objText.labels I see "Labels = {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}"
The code is:
Private Sub cmdAddLayers_Click()
Dim objText As MapWinGIS.Shapefile
Dim i As Integer
Dim strLabel As String
Dim dblX As Double, dblY As Double
objText = New MapWinGIS.Shapefile
If objText.Open("D:\Temp\Cascos Urbanos_region.shp") = True Then
AxMap1.AddLayer(objText, True)
With objText
.Labels.FontName = "Arial"
.Labels.FontSize = 12
'Shape-Objekt durchlaufen
For i = 0 To objText.NumShapes - 1
' Label-Text ermitteln
strLabel = objText.CellValue(0, i)
' Label-Koordinaten ermitteln
dblX = objText.Shape(i).Point(0).x
dblY = objText.Shape(i).Point(0).y
Try
objText.Labels.AddLabel(strLabel, dblX, dblY)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Next i
End With
End If
End Sub
The form display the shapefile but not the labels.