Assembly: System.Windows.Forms (in system.windows.forms.dll)
'Declaration <LocalizableAttribute(True)> _ Public Overridable Property Font As Font 'Usage Dim instance As Control Dim value As Font value = instance.Font instance.Font = value
Property ValueThe Font to apply to the text displayed by the control. The default is the value of the DefaultFont property.
The Font property is an ambient property. An ambient property is a control property that, if not set, is retrieved from the parent control. For example, a Button will have the same BackColor as its parent Form by default. For more information about ambient properties, see the AmbientProperties class or the Control class overview.
Because the Font is immutable (meaning that you cannot adjust any of its properties), you can only assign the Font property a new Font. However, you can base the new font on the existing font.
The following is an example of how to adjust the existing font to make it bold:
Private Sub myButton_Click(sender As Object, e As EventArgs) Dim myFontDialog As FontDialog myFontDialog = New FontDialog() If myFontDialog.ShowDialog() = DialogResult.OK Then ' Set the control's font. myDateTimePicker.Font = myFontDialog.Font End If End Sub
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.