Sub Globals
Dim pnlText As Panel
Dim cvsText As Canvas
Dim bmpText As Bitmap
Dim txt As String
Dim LineHeight As Float
Dim LineSpace = 2dip As Float
Dim TopMargin = 5dip As Float
Dim BottomMargin = 5dip As Float
Dim TextSize As Float
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlText.Initialize("")
Activity.AddView(pnlText, 0, 0, 500dip, 1000dip)
End Sub
Sub Activity_Resume
Dim i As Int
txt = "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
txt = txt & "This is a test text" & CRLF
TextSize = 18
cvsText.Initialize(Activity)
LineHeight = cvsText.MeasureStringHeight("Ag", Typeface.DEFAULT, TextSize) + LineSpace
Dim Lines() As String
Lines = Regex.Split(CRLF, txt)
Log(Lines.Length)
pnlText.Height = Lines.Length * LineHeight + TopMargin + BottomMargin
cvsText.Initialize(pnlText)
cvsText.DrawColor(Colors.White)
Dim y As Float
y = TopMargin
For i = 0 To Lines.Length - 1
y = y + LineHeight
cvsText.DrawText(Lines(i), 0, y, Typeface.DEFAULT, TextSize, Colors.Black, "LEFT")
Next
pnlText.Invalidate
End Sub