TextRenderingHint 列挙体
名前空間: System.Drawing.Text
アセンブリ: System.Drawing (system.drawing.dll 内)
構文
Public Enumeration TextRenderingHint

メンバ名 | 説明 | |
---|---|---|
AntiAlias | アンチエイリアス処理されたグリフ ビットマップを使用して、ヒンティングなしに各文字を描画します。アンチエイリアスによって品質が向上します。ヒンティングがオフにされるため、ステム幅の違いが目立ちます。 | |
AntiAliasGridFit | アンチエイリアス処理されたグリフ ビットマップを使用して、ヒンティングありで各文字を描画します。アンチエイリアスによってより高い品質が得られますが、パフォーマンスは大きく低下します。 | |
ClearTypeGridFit | グリフ ClearType ビットマップを使用して、ヒンティングありで各文字を描画します。最高の品質設定です。ClearType テキスト フォント機能を利用するときに使用します。 | |
SingleBitPerPixel | グリフ ビットマップを使用して各文字を描画します。ヒンティングは使用されません。 | |
SingleBitPerPixelGridFit | グリフ ビットマップを使用して各文字を描画します。ヒンティングを使用して、文字のステム部分と曲線部分の見た目を向上します。 | |
SystemDefault | グリフ ビットマップを使用し、システムの既定のレンダリング ヒントで各文字を描画します。ユーザーがシステムで選択した、すべてのフォント スムージング設定を使用してテキストを描画します。 |


TextRenderingHint プロパティ、TextContrast プロパティ、および TextRenderingHint 列挙体の使用方法を示すコード例を次に示します。
この例は、Windows フォームでの使用を意図してデザインされています。コードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡して ChangeTextRenderingHintAndTextContrast メソッドを呼び出します。
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
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: 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.get_Graphics(); // Declare a new font. Font myFont = new Font(FontFamily.get_GenericSansSerif(), 20, FontStyle.Regular); // Set the TextRenderingHint property. formGraphics.set_TextRenderingHint(System.Drawing.Text. TextRenderingHint.SingleBitPerPixel); // Draw the string. formGraphics.DrawString("Hello World", myFont, Brushes.get_Firebrick(), 20, 20); // Change the TextRenderingHint property. formGraphics.set_TextRenderingHint(System.Drawing.Text. TextRenderingHint.AntiAliasGridFit); // Draw the string again. formGraphics.DrawString("Hello World", myFont, Brushes.get_Firebrick(), 20, 60); // Set the text contrast to a high-contrast setting. formGraphics.set_TextContrast(0); // Draw the string. formGraphics.DrawString("Hello World", myFont, Brushes.get_DodgerBlue(), 20, 100); // Set the text contrast to a low-contrast setting. formGraphics.set_TextContrast(12); // Draw the string again. formGraphics.DrawString("Hello World", myFont, Brushes.get_DodgerBlue(), 20, 140); // Dispose of the font object. myFont.Dispose(); } //ChangeTextRenderingHintAndTextContrast

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- TextRenderingHint 列挙体のページへのリンク