Graphics::SetTextRenderingHint, méthode (gdiplusgraphics.h)

La méthode Graphics::SetTextRenderingHint définit le mode de rendu du texte de cet objet Graphics .

Syntaxe

Status SetTextRenderingHint(
  [in] TextRenderingHint newMode
);

Paramètres

[in] newMode

Type : TextRenderingHint

Élément de l’énumération TextRenderingHint qui spécifie le processus actuellement utilisé par cet objet Graphics pour afficher du texte.

Valeur retournée

Type : État

Si la méthode réussit, elle retourne Ok, qui est un élément de l’énumération Status .

Si la méthode échoue, elle retourne l’un des autres éléments de l’énumération Status .

Notes

TextRenderingHintClearTypeGridFit est pris en charge uniquement sur Windows XP et Windows Server 2003.

Vous ne pouvez pas utiliser TextRenderingHintClearTypeGridFit avec CompositingModeSourceCopy.

Exemples

L’exemple suivant définit l’indicateur de rendu de texte sur deux valeurs différentes et dessine du texte pour illustrer chaque valeur.

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)));
}

Spécifications

   
Client minimal pris en charge Windows XP, Windows 2000 Professionnel [applications de bureau uniquement]
Serveur minimal pris en charge Windows 2000 Server [applications de bureau uniquement]
Plateforme cible Windows
En-tête gdiplusgraphics.h (include Gdiplus.h)
Bibliothèque Gdiplus.lib
DLL Gdiplus.dll

Voir aussi

Anticrénelage avec du texte

CompositingMode

Graphismes

Graphics::GetTextRenderingHint

Graphics::SetCompositingMode

TextRenderingHint