Function halotext(ByVal text As String, ByVal fnt As Font, ByVal haloColor As Color, ByVal foreColor As Color) As Bitmap
[COLOR=darkgreen]'measure text[/COLOR]
Dim g As Graphics = Me.CreateGraphics
Dim sz As Size = Size.Round(g.MeasureString(text, fnt, Me.ClientSize))
Dim rct As New Rectangle(New Point(0, 0), sz)
g.Dispose()
[COLOR=darkgreen]'draw halo at 1/5th size, expand later to make fuzzy edges[/COLOR]
Dim haloBmp As New Bitmap(sz.Width \ 5, sz.Height \ 5)
g = Graphics.FromImage(haloBmp)
g.SmoothingMode = SmoothingMode.AntiAlias
Dim mx As New Matrix(1.0F / 5, 0, 0, 1.0F / 5, -(1.0F / 5), -(1.0F / 5))
g.Transform = mx
Dim pth As New GraphicsPath()
pth.AddString(text, fnt.FontFamily, fnt.Style, fnt.Size, rct, StringFormat.GenericTypographic)
g.DrawPath(New Pen(haloColor, 1), pth) [COLOR=darkgreen]'experiment pen width or remove this line[/COLOR]
g.FillPath(New SolidBrush(haloColor), pth)
g.Dispose()
[COLOR=darkgreen]'create full bitmap[/COLOR]
Dim Bmp As New Bitmap(rct.Width, rct.Height)
g = Graphics.FromImage(Bmp)
g.SmoothingMode = SmoothingMode.AntiAlias
g.InterpolationMode = InterpolationMode.HighQualityBicubic
rct.Offset(1, 1) [COLOR=darkgreen]'adjustment experiment[/COLOR]
g.DrawImage(haloBmp, rct) [COLOR=darkgreen]'expand halo[/COLOR]
g.FillPath(New SolidBrush(foreColor), pth) [COLOR=darkgreen]'draw 'real' text[/COLOR]
g.Dispose()
pth.Dispose()
Return Bmp
End Function