Table of text to paint event

Hi all,
Is there any simple way to convert a table of text (let’s say 3 columns x 5 rows) into drawing using the paint event of a canvas? If possible also with text alignment …
Any help on this direction is appreciated !! :wink:

Luciano

No simple way. You can loop through each column to find the longest string and use that to align the columns and draw separator lines.

Here’s some iOS code that I use to draw a legend that is displayed centered and has a white rectangle of just the right size behind the text.

Var fontsize As Double
If LargeLegend Then
  fontsize = 16
Else
  fontsize = 3.5
End If
Var legendfont As New Font("DINCondensed-Bold", fontsize * Scale)
g.Font = legendfont
// Y allows room for border element - Scale
// Background rectangle
g.DrawingColor = FeatureInverseColorGroup
g.FillRectangle(LeftWithOffset + Offset(1.0)/2 - g.TextWidth(Legend)/2, _
TopWithOffset + Offset(0.95) - Scale - g.TextHeight(Legend, 0), _
g.TextWidth(Legend), g.TextHeight(Legend, 0))
// Add baseline to Y to line things up - Ascent
// Legend
g.DrawingColor = FeatureColorGroup
g.DrawText(Legend, LeftWithOffset + Offset(1.0)/2 - g.TextWidth(Legend)/2, _
TopWithOffset + Offset(1.0) + g.Font.Ascent - Scale - g.TextHeight(Legend, 0))