Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Drawing.Text
public class PaintAllAvailableFonts
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
public class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
g.Clear(Me.BackColor)
Dim families As FontFamily() = FontFamily.GetFamilies(g)
Dim familiesFont As Font
Dim familyString As String
Dim spacing As Single = 0
Dim family As FontFamily
For Each family In families
familiesFont = New Font(family, 16, FontStyle.Bold)
familyString = "This is the " + family.Name + "family."
g.DrawString(familyString, familiesFont, Brushes.Black, New PointF(0, spacing))
spacing += familiesFont.Height
Next family
g.Dispose()
End Sub
Public Sub New()
MyBase.New()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
End Sub
End Class