A
Andy Roxburgh
Hi All, can anyone advise me why this code doesn't work? I get nothing
on the screen.
It's an attempt to write a string to an off-screen bitmap, then write
the bitmap to the screen. And incidentally I'm using the NETCF.
-----
Public Sub direct_draw_text_cent_tah_14(ByVal text_col As Color,
ByVal pointx As Integer, ByVal pointy As Integer, ByVal sizex As
Integer, ByVal sizey As Integer, ByVal drawtext As String)
Dim f As New Font("tahoma", 14.25, FontStyle.Regular)
Dim r As New RectangleF(pointx, pointy, sizex, sizey)
Dim b As New SolidBrush(text_col)
Dim bufferbmp As New Bitmap(sizex, sizey)
Dim g As Graphics = Graphics.FromImage(bufferbmp)
g.DrawString(drawtext, f, b, r)
g.Dispose()
Dim gg As Graphics = Me.CreateGraphics()
gg.DrawImage(bufferbmp, 0, 0)
gg.Dispose()
b.Dispose()
f.Dispose()
bufferbmp.Dispose()
End Sub
on the screen.
It's an attempt to write a string to an off-screen bitmap, then write
the bitmap to the screen. And incidentally I'm using the NETCF.
-----
Public Sub direct_draw_text_cent_tah_14(ByVal text_col As Color,
ByVal pointx As Integer, ByVal pointy As Integer, ByVal sizex As
Integer, ByVal sizey As Integer, ByVal drawtext As String)
Dim f As New Font("tahoma", 14.25, FontStyle.Regular)
Dim r As New RectangleF(pointx, pointy, sizex, sizey)
Dim b As New SolidBrush(text_col)
Dim bufferbmp As New Bitmap(sizex, sizey)
Dim g As Graphics = Graphics.FromImage(bufferbmp)
g.DrawString(drawtext, f, b, r)
g.Dispose()
Dim gg As Graphics = Me.CreateGraphics()
gg.DrawImage(bufferbmp, 0, 0)
gg.Dispose()
b.Dispose()
f.Dispose()
bufferbmp.Dispose()
End Sub