Graphics::SetTextRenderingHint method (gdiplusgraphics.h)
The Graphics::SetTextRenderingHint method sets the text rendering mode of this Graphics object.
Syntax
Status SetTextRenderingHint(
[in] TextRenderingHint newMode
);
Parameters
[in] newMode
Type: TextRenderingHint
Element of the TextRenderingHint enumeration that specifies the process currently used by this Graphics object to render text.
Return value
Type: Status
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Remarks
TextRenderingHintClearTypeGridFit is supported only on Windows XP and Windows Server 2003.
You cannot use TextRenderingHintClearTypeGridFit along with CompositingModeSourceCopy.
Examples
The following example sets the text rendering hint to two different values and draws text to demonstrate each value.
VOID Example_SetTextRenderingHint(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();
// Set the text rendering hint to TextRenderingHintAntiAlias.
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
Requirement | Value |
---|---|
Minimum supported client | Windows XP, Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | gdiplusgraphics.h (include Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |