I am using to following snippet to draw a string in a Bitmap
which is shown in a picturebox:
B4X:
dim pbstring as string = "abcde"
Dim pb As New PictureBox()
Dim bmp As New Bitmap(220, 320)
pb.Image = bmp
Using g As Graphics = Graphics.FromImage(bmp)
g.DrawString(pbstring, New Font("Arial", 12), Brushes.Black, 10, 10)
FlowLayoutPanel1.Controls.Add(pb)
I'm afraid I don't know what a Picturebox is, but if you want to create and display a drawing (including text) take a look at the canvas object : https://www.b4x.com/b4j/help/jfx.html#canvas