Labels - Drawlayer or shape file

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

Hello Colleen.

The fourth parameter of the AddLabel method should be the rotation (which you have equal to zero). Have you tried other values for this?

Hi

Thanks for this. Don’t know how on earth I missed that, when it is quite clearly there on the other options. I think sometimes I get so bogged down trying to figure out what is going on that I don’t see things right in front of me.

With regards to the aerial photo, I have at last got a URL that returns the entire image of our area (It seems to just be 1 big image). It used ArcGIS java script - so I just point to this and it returns the image. Just have to figure out how to get the image in MapWinGIS using the http address. It does not like the parameters zoom, x,y.

I have been told to use this image by the GIS section. I am a bit concerned as in the browser when I zoom in it seems very slow, but at this point I will just be happy if I can load it onto my Map at the correct place

Regards

Colleen