Share via


StringFormat ::GenericTypographic, méthode (gdiplusstringformat.h)

La méthode StringFormat ::GenericTypographic crée un objet StringFormat typographique générique.

Syntaxe

const StringFormat * GenericTypographic();

Valeur de retour

Type : StringFormat*

Cette méthode retourne un pointeur vers le nouvel objet StringFormat .

Remarques

Un objet StringFormat typographique générique présente les caractéristiques suivantes :

  • Les indicateurs de format de chaîne StringFormatFlagsLineLimit, StringFormatFlagsNoClip et StringFormatFlagsNoFitBlackBox sont définis.
  • L’alignement des caractères et l’alignement des lignes sont définis sur StringAlignmentNear.
  • L’ID de langue est défini sur une langue neutre, ce qui signifie que la langue actuelle associée au thread appelant est utilisée.
  • La substitution de chiffres de chaîne est définie sur StringDigitSubstituteUser.
  • Le préfixe de la touche rapide est défini sur HotkeyPrefixNone.
  • Le nombre de taquets de tabulation est défini sur zéro.
  • Le découpage de chaîne est défini sur StringTrimmingNone.

Exemples

L’exemple suivant crée un objet StringFormat typographique générique, puis l’utilise pour dessiner une chaîne mise en forme. Le code dessine également le rectangle de disposition de la chaîne.

VOID Example_GenericTypographic(HDC hdc)
{
   Graphics graphics(hdc);
   SolidBrush  solidBrush(Color(255, 255, 0, 0)); 
   FontFamily  fontFamily(L"Times New Roman");
   Font        font(&fontFamily, 12, FontStyleRegular, UnitPoint);
   
   // Create a generic typographic StringFormat object.
   const StringFormat* pStringFormat = StringFormat::GenericTypographic();
   // Use the generic typographic StringFormat object 
   // in a call to DrawString.
  graphics.DrawString(
      L"Formatted by a generic typographic StringFormat object", 
      54,  // string length
      &font, 
      RectF(30, 30, 100, 120), 
      pStringFormat, 
      &solidBrush);
   // Draw the rectangle that encloses the text.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawRectangle(&pen, 30, 30, 100, 120);
}

Configuration requise

Condition requise Valeur
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 gdiplusstringformat.h (inclure Gdiplus.h)
Bibliothèque Gdiplus.lib
DLL Gdiplus.dll

Voir aussi

Police

HotkeyPrefix

LOGFONT

RectF

StringAlignment

StringDigitSubstitute

StringFormat

StringFormatFlags

StringTrimming