Hi
I need to add a label to my Map. I allow the user to type in what they want in the label and choose the font and colour as well as being able to rotate the label, then they click on the Map and it will put the label where they click.
This works well, but I cannot find a way to change the font
Dim hndLabel As Long
hndLabel = Map1.DrawLabelEx(hndDraw, txtLabel, pnt1X, pnt1Y, Me.Rotate)
Map1.Redraw
then tried this but it ignores the font settings and does the same as the above
Dim DrawHnd As Integer
DrawHnd = Map1.NewDrawing(tkDrawReferenceList.dlSpatiallyReferencedList)
Dim objLabel As New mapwingis.Labels
objLabel.FontName = "Arial"
objLabel.FontSize = 16
objLabel.FontColor = RGB(0, 255, 255)
Set objLabel = Map1.DrawingLabels(hndDraw)
objLabel.Visible = True
objLabel.AddLabel "Test", pnt1X, pnt1Y, 0, -1
Map1.Redraw
The only way I could change the font settings was by creating a shape file, but then could not find a way to rotate the label
Dim objShFile As New Shapefile
objShFile.CreateNew "", ShpfileType.SHP_POINT
Map1.AddLayer objShFile, True
' create and add Shape '
' (it seems that at least 1 shape has to exist in the Shapefile, or an exception is thrown) '
Dim shp As New mapwingis.Shape
shp.Create SHP_POINT
shp.AddPoint pnt1X, pnt1Y
bool = objShFile.EditAddShape(shp)
' to do freestanding labels, they must be unsynchronized from the shapes '
' otherwise, you would add one label per shape, and the label follows the shape '
With objShFile.Labels
.FontName = Me.FontName
.FontSize = Me.FontSize
.FontColor = Me.FontColour
.FontItalic = Me.FontItalic
.FontOutlineColor = vbYellow
.FontOutlineWidth = 12
.FrameVisible = True
.FrameBackColor = vbWhite
.Synchronized = False
.Visible = True
.AddLabel "Test", pnt1X, pnt1Y, 0, -1
End With
Map1.Redraw
Is there a way to change the Font type, size and colour with the DrawLabel. If not is there a way to rotate the label with the shape file option
Thanks
Colleen Crawford