TextRenderingHint 열거형

정의

텍스트 렌더링의 품질을 지정합니다.

public enum class TextRenderingHint
public enum TextRenderingHint
type TextRenderingHint = 
Public Enum TextRenderingHint
상속
TextRenderingHint

필드

Name Description
SystemDefault 0

각 문자는 시스템 기본 렌더링 힌트와 함께 문자 모양 비트맵을 사용하여 그려집니다. 사용자가 시스템에 대해 선택한 글꼴 부드러운 설정을 사용하여 텍스트를 그립니다.

SingleBitPerPixelGridFit 1

각 문자는 문자 모양 비트맵을 사용하여 그려집니다. 힌트는 줄기와 곡률에 대한 문자 모양을 개선하는 데 사용됩니다.

SingleBitPerPixel 2

각 문자는 문자 모양 비트맵을 사용하여 그려집니다. 힌트는 사용되지 않습니다.

AntiAliasGridFit 3

각 문자는 힌트와 함께 앤티앨리어싱된 문자 모양 비트맵을 사용하여 그려집니다. 앤티앨리어싱으로 인해 품질이 훨씬 향상되었지만 성능이 더 높습니다.

AntiAlias 4

각 문자는 힌트 없이 앤티앨리어싱된 문자 모양 비트맵을 사용하여 그려집니다. 앤티앨리어싱으로 인해 품질이 향상되었습니다. 힌트가 꺼져 있으므로 줄기 너비 차이가 눈에 띄어질 수 있습니다.

ClearTypeGridFit 5

각 문자는 힌트와 함께 해당 문자 모양 ClearType 비트맵을 사용하여 그려집니다. 최고 품질의 설정입니다. ClearType 글꼴 기능을 활용하는 데 사용됩니다.

예제

다음 코드 예제에서는 및 TextRenderingHint 속성 및 열거형의 TextContrastTextRenderingHint 사용을 보여 줍니다.

이 예제는 Windows Forms와 함께 사용하도록 설계되었습니다. 폼에 코드를 붙여넣고 양식의 ChangeTextRenderingHintAndTextContrast 이벤트를 처리할 때 메서드를 호출 Paint 하여 다음과 같이 e전달 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

설명

품질은 텍스트(가장 빠른 성능이지만 가장 낮은 품질)에서 앤티앨리어싱된 텍스트(품질이 향상되었지만 성능 저하)에서 ClearType 텍스트(LCD 디스플레이의 최고 품질)에 이르기까지 다양합니다.

적용 대상