TextRenderingHint 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
텍스트 렌더링 품질을 지정합니다.
public enum class TextRenderingHint
public enum TextRenderingHint
type TextRenderingHint =
Public Enum TextRenderingHint
- 상속
필드
Name | 값 | Description |
---|---|---|
AntiAlias | 4 | 각 문자가 힌팅 없이 해당 앤티 앨리어싱된 문자 모양 비트맵을 사용하여 그려집니다. 앤티 앨리어싱으로 인해 품질은 더 낫지만 힌팅을 사용하지 않기 때문에 세로 획 너비에서 차이가 생길 수 있습니다. |
AntiAliasGridFit | 3 | 각 문자가 힌팅을 사용한 상태에서 해당 앤티 앨리어싱된 문자 모양 비트맵을 사용하여 그려집니다. 앤티 앨리어싱으로 인해 품질은 더 낫지만 성능은 떨어집니다. |
ClearTypeGridFit | 5 | 각 문자가 힌팅을 사용한 상태에서 해당 문자 모양 ClearType 비트맵을 사용하여 그려집니다. 최고 품질 설정으로, ClearType 글꼴 기능을 활용하는 데 사용됩니다. |
SingleBitPerPixel | 2 | 각 문자가 해당 문자 모양 비트맵을 사용하여 그려집니다. 힌팅은 사용되지 않습니다. |
SingleBitPerPixelGridFit | 1 | 각 문자가 해당 문자 모양 비트맵을 사용하여 그려집니다. 힌팅을 사용하여 세로 획과 곡선에서의 문자 모양이 향상됩니다. |
SystemDefault | 0 | 각 문자가 시스템 기본 렌더링 힌팅과 함께 해당 문자 모양 비트맵을 사용하여 그려집니다. 텍스트가 해당 시스템에 대해 사용자가 선택한 글꼴 다듬기 설정을 사용하여 그려집니다. |
예제
다음 코드 예제에서는 사용 TextRenderingHintTextContrast 하는 및 속성 및 TextRenderingHint 열거형입니다.
이 예제는 Windows Forms 사용하도록 설계되었습니다. 폼에 코드를 붙여넣고 양식의 Paint 이벤트를 처리할 때 메서드를 호출 ChangeTextRenderingHintAndTextContrast
하여 로 PaintEventArgs전달 e
합니다.
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 디스플레이의 최고 품질)에 이르기까지 다양합니다.