Graphics.TextRenderingHint プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Graphics.TextRenderingHint プロパティの意味・解説 

Graphics.TextRenderingHint プロパティ

この Graphics関連付けられているテキストレンダリング モード取得または設定します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Property TextRenderingHint As
 TextRenderingHint
Dim instance As Graphics
Dim value As TextRenderingHint

value = instance.TextRenderingHint

instance.TextRenderingHint = value
public TextRenderingHint TextRenderingHint { get;
 set; }
public:
property TextRenderingHint TextRenderingHint {
    TextRenderingHint get ();
    void set (TextRenderingHint value);
}
/** @property */
public TextRenderingHint get_TextRenderingHint ()

/** @property */
public void set_TextRenderingHint (TextRenderingHint
 value)
public function get TextRenderingHint
 () : TextRenderingHint

public function set TextRenderingHint
 (value : TextRenderingHint)

プロパティ
TextRenderingHint 値の 1 つ

解説解説
使用例使用例

TextRenderingHint プロパティと TextContrast プロパティ使用方法を示すコード例次に示します

この例は、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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からGraphics.TextRenderingHint プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からGraphics.TextRenderingHint プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からGraphics.TextRenderingHint プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Graphics.TextRenderingHint プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Graphics.TextRenderingHint プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS