Private Sub FromHfontmenu_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Create the Graphics object
Dim g As Graphics = Me.CreateGraphics()
'Create a brush
Dim brush As New SolidBrush(Color.Red)
'Get a handle
Dim hFont__1 As Intptr = GetStockobject(o)
'Create a font from the handle A
Dim hfontFont As Font = Font.FromHfont(hfont)
'Draw text
g.DrawString("GDI HFONT", hfontFont, brush, 20, 20)
'Dipose of objects
hfontFont.Dispose()
g.Dispose()
End Sub
Figure 5.12 shows the output from Listing 5.7