TextRenderingHint Enumeração

Definição

Especifica a qualidade de renderização do texto.Specifies the quality of text rendering.

public enum class TextRenderingHint
public enum TextRenderingHint
type TextRenderingHint = 
Public Enum TextRenderingHint
Herança
TextRenderingHint

Campos

AntiAlias 4

Cada caractere é desenhado usando seu bitmap de glifo com suavização sem dicas.Each character is drawn using its antialiased glyph bitmap without hinting. Melhor qualidade devido à suavização.Better quality due to antialiasing. Diferenças de largura de hastes podem ser perceptíveis, pois as dicas estão desativadas.Stem width differences may be noticeable because hinting is turned off.

AntiAliasGridFit 3

Cada caractere é desenhado usando seu bitmap de glifo com suavização e dicas.Each character is drawn using its antialiased glyph bitmap with hinting. Qualidade muito melhor devido à suavização, porém com custo de desempenho mais alto.Much better quality due to antialiasing, but at a higher performance cost.

ClearTypeGridFit 5

Cada caractere é desenhado usando seu bitmap ClearType de glifo com dicas.Each character is drawn using its glyph ClearType bitmap with hinting. A configuração de qualidade mais alta.The highest quality setting. Usado para tirar proveito dos recursos de fonte ClearType.Used to take advantage of ClearType font features.

SingleBitPerPixel 2

Cada caractere é desenhado usando seu bitmap de glifo.Each character is drawn using its glyph bitmap. As dicas não são usadas.Hinting is not used.

SingleBitPerPixelGridFit 1

Cada caractere é desenhado usando seu bitmap de glifo.Each character is drawn using its glyph bitmap. As dicas são usadas para melhorar a aparência de caractere nas hastes e curvaturas.Hinting is used to improve character appearance on stems and curvature.

SystemDefault 0

Cada caractere é desenhado usando seu bitmap de glifo, com a dica de renderização padrão do sistema.Each character is drawn using its glyph bitmap, with the system default rendering hint. O texto será desenhado usando as configurações de suavização de fonte selecionadas pelo usuário para o sistema.The text will be drawn using whatever font-smoothing settings the user has selected for the system.

Exemplos

O exemplo de código a seguir demonstra o uso TextRenderingHint das TextContrast Propriedades e e a TextRenderingHint enumeração.The following code example demonstrates the use of the TextRenderingHint and TextContrast properties and the TextRenderingHint enumeration.

Este exemplo foi projetado para ser usado com Windows Forms.This example is designed to be used with Windows Forms. Cole o código em um formulário e chame o ChangeTextRenderingHintAndTextContrast método ao manipular o evento do formulário Paint , passando 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

Comentários

A qualidade varia de texto (desempenho mais rápido, mas qualidade mais baixa) a texto com suavização de serrilhado (melhor qualidade, mas desempenho mais lento) a texto ClearType (melhor qualidade em uma tela de 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).

Aplica-se a