Export (0) Print
Expand All

FontDialog Class

Prompts the user to choose a font from among those installed on the local computer.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

type FontDialog =  
    class
        inherit CommonDialog
    end

The FontDialog type exposes the following members.

  NameDescription
Public methodFontDialogInitializes a new instance of the FontDialog class.
Top

  NameDescription
Public propertyAllowScriptChangeGets or sets a value indicating whether the user can change the character set specified in the Script combo box to display a character set other than the one currently displayed.
Public propertyAllowSimulationsGets or sets a value indicating whether the dialog box allows graphics device interface (GDI) font simulations.
Public propertyAllowVectorFontsGets or sets a value indicating whether the dialog box allows vector font selections.
Public propertyAllowVerticalFontsGets or sets a value indicating whether the dialog box displays both vertical and horizontal fonts or only horizontal fonts.
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event. (Inherited from Component.)
Public propertyColorGets or sets the selected font color.
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Protected propertyEventsGets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public propertyFixedPitchOnlyGets or sets a value indicating whether the dialog box allows only the selection of fixed-pitch fonts.
Public propertyFontGets or sets the selected font.
Public propertyFontMustExistGets or sets a value indicating whether the dialog box specifies an error condition if the user attempts to select a font or style that does not exist.
Public propertyMaxSizeGets or sets the maximum point size a user can select.
Public propertyMinSizeGets or sets the minimum point size a user can select.
Protected propertyOptionsInfrastructure. Gets values to initialize the FontDialog.
Public propertyScriptsOnlyGets or sets a value indicating whether the dialog box allows selection of fonts for all non-OEM and Symbol character sets, as well as the ANSI character set.
Public propertyShowApplyGets or sets a value indicating whether the dialog box contains an Apply button.
Public propertyShowColorGets or sets a value indicating whether the dialog box displays the color choice.
Public propertyShowEffectsGets or sets a value indicating whether the dialog box contains controls that allow the user to specify strikethrough, underline, and text color options.
Public propertyShowHelpGets or sets a value indicating whether the dialog box displays a Help button.
Public propertySiteGets or sets the ISite of the Component. (Inherited from Component.)
Public propertyTagGets or sets an object that contains data about the control. (Inherited from CommonDialog.)
Top

  NameDescription
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDispose()Releases all resources used by the Component. (Inherited from Component.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodHookProcSpecifies the common dialog box hook procedure that is overridden to add specific functionality to a common dialog box. (Overrides CommonDialog.HookProc(IntPtr, Int32, IntPtr, IntPtr).)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected methodOnApplyRaises the Apply event.
Protected methodOnHelpRequestRaises the HelpRequest event. (Inherited from CommonDialog.)
Protected methodOwnerWndProcDefines the owner window procedure that is overridden to add specific functionality to a common dialog box. (Inherited from CommonDialog.)
Public methodResetResets all dialog box options to their default values. (Overrides CommonDialog.Reset().)
Protected methodRunDialogInfrastructure. Specifies a file dialog box. (Overrides CommonDialog.RunDialog(IntPtr).)
Public methodShowDialog()Runs a common dialog box with a default owner. (Inherited from CommonDialog.)
Public methodShowDialog(IWin32Window)Runs a common dialog box with the specified owner. (Inherited from CommonDialog.)
Public methodToStringInfrastructure. Retrieves a string that includes the name of the current font selected in the dialog box. (Overrides Component.ToString().)
Top

  NameDescription
Public eventApplyOccurs when the user clicks the Apply button in the font dialog box.
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public eventHelpRequestOccurs when the user clicks the Help button on a common dialog box. (Inherited from CommonDialog.)
Top

  NameDescription
Protected fieldStatic memberEventApplyInfrastructure. Owns the Apply event.
Top

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.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft