FontDialog Class
Prompts the user to choose a font from among those installed on the local computer.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The inherited member ShowDialog must be invoked to create this specific common dialog box. HookProc can be overridden to implement specific dialog box hook functionality.
When you create an instance of FontDialog, some of the read/write properties are set to initial values. For a list of these values, see the FontDialog constructor.
The following code example uses ShowDialog to display a FontDialog. This code requires that a Form has already been created with a TextBox and button placed on it. It also requires that the fontDialog1 has been created. The Font contains the size information but not the color information.
Private Sub button1_Click(sender As Object, e As System.EventArgs) fontDialog1.ShowColor = True fontDialog1.Font = textBox1.Font fontDialog1.Color = textBox1.ForeColor If fontDialog1.ShowDialog() <> DialogResult.Cancel Then textBox1.Font = fontDialog1.Font textBox1.ForeColor = fontDialog1.Color End If End Sub 'button1_Click
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.CommonDialog
System.Windows.Forms.FontDialog
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.