TextRenderingHint 列挙型

定義

テキストレンダリングの品質を指定します。

public enum class TextRenderingHint
public enum TextRenderingHint
type TextRenderingHint = 
Public Enum TextRenderingHint
継承
TextRenderingHint

フィールド

名前 説明
SystemDefault 0

各文字は、システムの既定のレンダリング ヒントを使用して、グリフ ビットマップを使用して描画されます。 テキストは、ユーザーがシステムに対して選択したフォント スムージング設定を使用して描画されます。

SingleBitPerPixelGridFit 1

各文字はグリフ ビットマップを使用して描画されます。 ヒントは、茎と曲率の文字の外観を向上させるために使用されます。

SingleBitPerPixel 2

各文字はグリフ ビットマップを使用して描画されます。 ヒントは使用されません。

AntiAliasGridFit 3

各文字は、ヒント付きのアンチエイリアシングされたグリフ ビットマップを使用して描画されます。 アンチエイリアシングにより品質が大幅に向上しますが、パフォーマンスコストが高くなります。

AntiAlias 4

各文字は、ヒントなしでアンチエイリアシングされたグリフ ビットマップを使用して描画されます。 アンチエイリアシングによる品質の向上。 ヒントがオフになっているため、茎の幅の違いが目立つ場合があります。

ClearTypeGridFit 5

各文字は、ヒント付きのグリフ ClearType ビットマップを使用して描画されます。 最高品質の設定。 ClearType フォント機能を利用するために使用されます。

次のコード例では、 TextRenderingHint プロパティと TextContrast プロパティ、および TextRenderingHint 列挙体の使用方法を示します。

この例は、Windows フォームで使用するように設計されています。 フォームにコードを貼り付け、フォームの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 ディスプレイの最高品質) までです。

適用対象