Graphics.GetTextRenderingHint method

Applies to: desktop apps only

The Graphics::GetTextRenderingHint method returns the text rendering mode currently set for this Graphics object.

Syntax

TextRenderingHint GetTextRenderingHint() const;

Parameters

This method has no parameters.

Return value

Type:

Type: TextRenderingHint

This method returns an element of the TextRenderingHint enumeration that indicates the process currently used by this Graphics object to render text.

Examples

The following example sets the text-rendering hint to low quality and draws text. It then gets the text-rendering hint, changes it to high quality, and draws more text to demonstrate the difference.


VOID Example_GetTextRenderingHint(HDC hdc)
{
   Graphics graphics(hdc);

   // Set the text rendering hint to TextRenderingHintSingleBitPerPixel. 
   graphics.SetTextRenderingHint(TextRenderingHintSingleBitPerPixel);

   // Draw text.
   graphics.DrawString(
        L"Low quality rendering",
        21,
        &Font(L"Arial", 24),
        PointF(0, 0),
        &SolidBrush(Color(255, 0, 0, 0)));

   // Get the text-rendering hint.
   TextRenderingHint hint = graphics.GetTextRenderingHint();

   // Test hint, and set the text-rendering hint to TextRenderingHintAntiAlias. 
   if (hint == TextRenderingHintSingleBitPerPixel)
   {
      graphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
   }

   // Draw more text to demonstrate the difference.
   graphics.DrawString(
       L"High quality rendering",
       22,
       &Font(L"Arial", 24),
       PointF(0, 50),
       &SolidBrush(Color(255, 0, 0, 0)));
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
TextRenderingHint

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show: