TextRenderingHint TextRenderingHint TextRenderingHint TextRenderingHint Enum

Definición

Especifica la calidad de representación de texto.Specifies the quality of text rendering.

public enum class TextRenderingHint
public enum TextRenderingHint
type TextRenderingHint = 
Public Enum TextRenderingHint
Herencia
TextRenderingHintTextRenderingHintTextRenderingHintTextRenderingHint

Campos

AntiAlias AntiAlias AntiAlias AntiAlias 4

Cada carácter se dibuja utilizando su mapa de bits de glifo con suavizado de contorno sin indicaciones.Each character is drawn using its antialiased glyph bitmap without hinting. Debido al suavizado de contorno, la calidad es mejor.Better quality due to antialiasing. Las diferencias de ancho del pie pueden ser apreciables porque se han desactivado las indicaciones.Stem width differences may be noticeable because hinting is turned off.

AntiAliasGridFit AntiAliasGridFit AntiAliasGridFit AntiAliasGridFit 3

Cada carácter se dibuja utilizando su mapa de bits de glifo con suavizado de contorno con indicaciones.Each character is drawn using its antialiased glyph bitmap with hinting. Debido al suavizado de contorno, la calidad es mucho mejor, pero se produce un costo de rendimiento mayor.Much better quality due to antialiasing, but at a higher performance cost.

ClearTypeGridFit ClearTypeGridFit ClearTypeGridFit ClearTypeGridFit 5

Cada carácter se dibuja utilizando su mapa de bits de glifo de ClearType con indicaciones.Each character is drawn using its glyph ClearType bitmap with hinting. Configuración de mayor calidad.The highest quality setting. Se utiliza para beneficiarse de las características de fuente de ClearType.Used to take advantage of ClearType font features.

SingleBitPerPixel SingleBitPerPixel SingleBitPerPixel SingleBitPerPixel 2

Cada carácter se dibuja utilizando su mapa de bits de glifo.Each character is drawn using its glyph bitmap. No se utilizan indicaciones.Hinting is not used.

SingleBitPerPixelGridFit SingleBitPerPixelGridFit SingleBitPerPixelGridFit SingleBitPerPixelGridFit 1

Cada carácter se dibuja utilizando su mapa de bits de glifo.Each character is drawn using its glyph bitmap. Se utilizan indicaciones para mejorar la apariencia de caracteres en los pies y la curvatura.Hinting is used to improve character appearance on stems and curvature.

SystemDefault SystemDefault SystemDefault SystemDefault 0

Cada carácter se dibuja utilizando su mapa de bits de glifo, con la indicación de representación predeterminada del sistema.Each character is drawn using its glyph bitmap, with the system default rendering hint. El texto se dibuja utilizando cualquier configuración de suavizado de fuente que el usuario haya seleccionado para el sistema.The text will be drawn using whatever font-smoothing settings the user has selected for the system.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la TextRenderingHint y TextContrast propiedades y el TextRenderingHint enumeración.The following code example demonstrates the use of the TextRenderingHint and TextContrast properties and the TextRenderingHint enumeration.

En este ejemplo está diseñado para usarse con Windows Forms.This example is designed to be used with Windows Forms. Pegue el código en un formulario y llame a la ChangeTextRenderingHintAndTextContrast método cuando el control del formulario Paint evento pasando e como PaintEventArgs.Paste the code into a form and call the ChangeTextRenderingHintAndTextContrast method when handling the form's Paint event, passing e as PaintEventArgs.

private:
   void ChangeTextRenderingHintAndTextContrast( PaintEventArgs^ e )
   {
      // Retrieve the graphics object.
      Graphics^ formGraphics = e->Graphics;

      // Declare a new font.
      System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,20,FontStyle::Regular );

      // Set the TextRenderingHint property.
      formGraphics->TextRenderingHint = System::Drawing::Text::TextRenderingHint::SingleBitPerPixel;

      // Draw the string.
      formGraphics->DrawString( "Hello World", myFont, Brushes::Firebrick, 20.0F, 20.0F );

      // Change the TextRenderingHint property.
      formGraphics->TextRenderingHint = System::Drawing::Text::TextRenderingHint::AntiAliasGridFit;

      // Draw the string again.
      formGraphics->DrawString( "Hello World", myFont, Brushes::Firebrick, 20.0F, 60.0F );

      // Set the text contrast to a high-contrast setting.
      formGraphics->TextContrast = 0;

      // Draw the string.
      formGraphics->DrawString( "Hello World", myFont, Brushes::DodgerBlue, 20.0F, 100.0F );

      // Set the text contrast to a low-contrast setting.
      formGraphics->TextContrast = 12;

      // Draw the string again.
      formGraphics->DrawString( "Hello World", myFont, Brushes::DodgerBlue, 20.0F, 140.0F );

      // Dispose of the font object.
      delete myFont;
   }
private void ChangeTextRenderingHintAndTextContrast(PaintEventArgs e)
{

    // Retrieve the graphics object.
    Graphics formGraphics = e.Graphics;

    // Declare a new font.
    Font myFont = new Font(FontFamily.GenericSansSerif, 20, 
        FontStyle.Regular);

    // Set the TextRenderingHint property.
    formGraphics.TextRenderingHint = 
        System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;

    // Draw the string.
    formGraphics.DrawString("Hello World", myFont, 
        Brushes.Firebrick, 20.0F, 20.0F);

    // Change the TextRenderingHint property.
    formGraphics.TextRenderingHint = 
        System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

    // Draw the string again.
    formGraphics.DrawString("Hello World", myFont, 
        Brushes.Firebrick, 20.0F, 60.0F);

    // Set the text contrast to a high-contrast setting.
    formGraphics.TextContrast = 0;

    // Draw the string.
    formGraphics.DrawString("Hello World", myFont, 
        Brushes.DodgerBlue, 20.0F, 100.0F);

    // Set the text contrast to a low-contrast setting.
    formGraphics.TextContrast = 12;

    // Draw the string again.
    formGraphics.DrawString("Hello World", myFont, 
        Brushes.DodgerBlue, 20.0F, 140.0F);

    // Dispose of the font object.
    myFont.Dispose();

}
Private Sub ChangeTextRenderingHintAndTextContrast(ByVal e As _
    PaintEventArgs)

    ' Retrieve the graphics object.
    Dim formGraphics As Graphics = e.Graphics

    ' Declare a new font.
    Dim myFont As Font = New Font(FontFamily.GenericSansSerif, _
        20, FontStyle.Regular)

    ' Set the TextRenderingHint property.
    formGraphics.TextRenderingHint = _
        System.Drawing.Text.TextRenderingHint.SingleBitPerPixel

    ' Draw the string.
    formGraphics.DrawString("Hello World", myFont, _
        Brushes.Firebrick, 20.0F, 20.0F)

    ' Change the TextRenderingHint property.
    formGraphics.TextRenderingHint = _
        System.Drawing.Text.TextRenderingHint.AntiAliasGridFit

    ' Draw the string again.
    formGraphics.DrawString("Hello World", myFont, _
        Brushes.Firebrick, 20.0F, 60.0F)

    ' Set the text contrast to a high-contrast setting.
    formGraphics.TextContrast = 0

    ' Draw the string.
    formGraphics.DrawString("Hello World", myFont, _
        Brushes.DodgerBlue, 20.0F, 100.0F)

    ' Set the text contrast to a low-contrast setting.
    formGraphics.TextContrast = 12

    ' Draw the string again.
    formGraphics.DrawString("Hello World", myFont, _
        Brushes.DodgerBlue, 20.0F, 140.0F)

    ' Dispose of the font object.
    myFont.Dispose()

End Sub

Comentarios

Los intervalos de calidad de texto (rendimiento más rápido, pero menor calidad) a texto con suavizado de contorno (de mayor calidad, pero un rendimiento más lento) y a texto ClearType (mejor calidad en un monitor LCD).The quality ranges from text (fastest performance, but lowest quality) to antialiased text (better quality, but slower performance) to ClearType text (best quality on an LCD display).

Se aplica a