DrawText Example


Draws text on the screen using the DrawText method of the Map object.

VBScript Code

Copy Code
Sub DrawText
      'Create an ellipse object and set its extent to 40% of the current map extent
      Dim pEllipse, pRect
      Set pEllipse = Application.CreateAppObject ("ellipse")
      Set pRect = Map.Extent
      pRect.ScaleRectangle 0.4
      pEllipse.Extent = pRect
      'Create a font object and set it to bold and underlined
      Dim pFont
      Set pFont = Application.CreateAppObject ("font")
      pFont.Bold = True
      pFont.Underline = True
      'Create some text to display
      Dim strText
      strText = "I Love ArcPad"
      'Create a textsymbol object and set some display properties
      Dim pTextSymbol
      Set pTextSymbol = Application.CreateAppObject ("textsymbol")
      pTextSymbol.Font = pFont
      pTextSymbol.Angle = 30.0
      pTextSymbol.BackgroundColor = 255  'red
      pTextSymbol.BackgroundMode = 2  'opaque
      pTextSymbol.Color = 8388736  'purple
      pTextSymbol.Size = 25
      'Draw the text to the screen
      Map.DrawText strText, pEllipse, pTextSymbol
      'Free resources
      Set pEllipse = Nothing
      Set pRect = Nothing
      Set pFont = Nothing
      Set pTextSymbol = Nothing
End Sub