FontDialog Class
TOC
Collapse the table of content
Expand the table of content

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)

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.CommonDialog
        System.Windows.Forms.FontDialog

public class FontDialog : CommonDialog

NameDescription
System_CAPS_pubmethodFontDialog()

Initializes a new instance of the FontDialog class.

NameDescription
System_CAPS_pubpropertyAllowScriptChange

Gets 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.

System_CAPS_pubpropertyAllowSimulations

Gets or sets a value indicating whether the dialog box allows graphics device interface (GDI) font simulations.

System_CAPS_pubpropertyAllowVectorFonts

Gets or sets a value indicating whether the dialog box allows vector font selections.

System_CAPS_pubpropertyAllowVerticalFonts

Gets or sets a value indicating whether the dialog box displays both vertical and horizontal fonts or only horizontal fonts.

System_CAPS_protpropertyCanRaiseEvents

Gets a value indicating whether the component can raise an event.(Inherited from Component.)

System_CAPS_pubpropertyColor

Gets or sets the selected font color.

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_pubpropertyFixedPitchOnly

Gets or sets a value indicating whether the dialog box allows only the selection of fixed-pitch fonts.

System_CAPS_pubpropertyFont

Gets or sets the selected font.

System_CAPS_pubpropertyFontMustExist

Gets 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.

System_CAPS_pubpropertyMaxSize

Gets or sets the maximum point size a user can select.

System_CAPS_pubpropertyMinSize

Gets or sets the minimum point size a user can select.

System_CAPS_protpropertyOptions

This API supports the product infrastructure and is not intended to be used directly from your code. Gets values to initialize the FontDialog.

System_CAPS_pubpropertyScriptsOnly

Gets 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.

System_CAPS_pubpropertyShowApply

Gets or sets a value indicating whether the dialog box contains an Apply button.

System_CAPS_pubpropertyShowColor

Gets or sets a value indicating whether the dialog box displays the color choice.

System_CAPS_pubpropertyShowEffects

Gets or sets a value indicating whether the dialog box contains controls that allow the user to specify strikethrough, underline, and text color options.

System_CAPS_pubpropertyShowHelp

Gets or sets a value indicating whether the dialog box displays a Help button.

System_CAPS_pubpropertySite

Gets or sets the ISite of the Component.(Inherited from Component.)

System_CAPS_pubpropertyTag

Gets or sets an object that contains data about the control. (Inherited from CommonDialog.)

NameDescription
System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.(Inherited from Component.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.(Inherited from Component.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodHookProc(IntPtr, Int32, IntPtr, IntPtr)

Specifies 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).)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodOnApply(EventArgs)

Raises the Apply event.

System_CAPS_protmethodOnHelpRequest(EventArgs)

Raises the HelpRequest event.(Inherited from CommonDialog.)

System_CAPS_protmethodOwnerWndProc(IntPtr, Int32, IntPtr, IntPtr)

Defines the owner window procedure that is overridden to add specific functionality to a common dialog box.(Inherited from CommonDialog.)

System_CAPS_pubmethodReset()

Resets all dialog box options to their default values.(Overrides CommonDialog.Reset().)

System_CAPS_protmethodRunDialog(IntPtr)

This API supports the product infrastructure and is not intended to be used directly from your code. Specifies a file dialog box.(Overrides CommonDialog.RunDialog(IntPtr).)

System_CAPS_pubmethodShowDialog()

Runs a common dialog box with a default owner.(Inherited from CommonDialog.)

System_CAPS_pubmethodShowDialog(IWin32Window)

Runs a common dialog box with the specified owner.(Inherited from CommonDialog.)

System_CAPS_pubmethodToString()

This API supports the product infrastructure and is not intended to be used directly from your code. Retrieves a string that includes the name of the current font selected in the dialog box.(Overrides Component.ToString().)

NameDescription
System_CAPS_protfieldSystem_CAPS_staticEventApply

This API supports the product infrastructure and is not intended to be used directly from your code. Owns the Apply event.

NameDescription
System_CAPS_pubeventApply

Occurs when the user clicks the Apply button in the font dialog box.

System_CAPS_pubeventDisposed

Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)

System_CAPS_pubeventHelpRequest

Occurs when the user clicks the Help button on a common dialog box.(Inherited from CommonDialog.)

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 void button1_Click(object sender, System.EventArgs e)
 {
    fontDialog1.ShowColor = true;

    fontDialog1.Font = textBox1.Font;
    fontDialog1.Color = textBox1.ForeColor;

    if(fontDialog1.ShowDialog() != DialogResult.Cancel )
    {
       textBox1.Font = fontDialog1.Font ;
       textBox1.ForeColor = fontDialog1.Color;
    }
 }

.NET Framework
Available since 1.1

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

Return to top
Show:
© 2016 Microsoft