Share via


StringFormat::GenericTypographic-Methode (gdiplusstringformat.h)

Die StringFormat::GenericTypographic-Methode erstellt ein generisches, typografisches StringFormat-Objekt .

Syntax

const StringFormat * GenericTypographic();

Rückgabewert

Typ: StringFormat*

Diese Methode gibt einen Zeiger auf das neue StringFormat-Objekt zurück.

Hinweise

Ein generisches typografisches StringFormat-Objekt weist die folgenden Merkmale auf:

  • ZeichenfolgenformatflagsLineLimit, StringFormatFlagsNoClip und StringFormatFlagsNoFitBlackBox sind festgelegt.
  • Zeichenausrichtung und Linienausrichtung sind auf StringAlignmentNear festgelegt.
  • Die Sprach-ID ist auf neutrale Sprache festgelegt, was bedeutet, dass die aktuelle Sprache verwendet wird, die dem aufrufenden Thread zugeordnet ist.
  • Die Zeichenfolgenersetzung ist auf StringDigitSubstituteUser festgelegt.
  • Das Präfix für hot key ist auf HotkeyPrefixNone festgelegt.
  • Die Anzahl der Tabstopps ist auf 0 festgelegt.
  • Das Kürzen von Zeichenfolgen ist auf StringTrimmingNone festgelegt.

Beispiele

Im folgenden Beispiel wird ein generisches typografisches StringFormat-Objekt erstellt und anschließend zum Zeichnen einer formatierten Zeichenfolge verwendet. Der Code zeichnet auch das Layoutrechteck der Zeichenfolge.

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

Anforderungen

Anforderung Wert
Unterstützte Mindestversion (Client) Windows XP, Windows 2000 Professional [nur Desktop-Apps]
Unterstützte Mindestversion (Server) Windows 2000 Server [nur Desktop-Apps]
Zielplattform Windows
Kopfzeile gdiplusstringformat.h (include Gdiplus.h)
Bibliothek Gdiplus.lib
DLL Gdiplus.dll

Weitere Informationen

Schriftart

Hotkeyprefix

LOGFONT

RectF

StringAlignment

StringDigitSubstitute

StringFormat

Stringformatflags

Stringtrimming