Condividi tramite


Metodo StringFormat::GenericTypographic (gdiplusstringformat.h)

Il metodo StringFormat::GenericTypographic crea un oggetto StringFormat generico e tipografico.

Sintassi

const StringFormat * GenericTypographic();

Valore restituito

Tipo: StringFormat*

Questo metodo restituisce un puntatore al nuovo oggetto StringFormat .

Commenti

Un oggetto StringFormat generico e tipografico presenta le caratteristiche seguenti:

  • I flag di formato stringa StringFormatFlagsLineLimit, StringFormatFlagsNoClip e StringFormatFlagsNoFitBlackBox sono impostati.
  • L'allineamento dei caratteri e l'allineamento della riga sono impostati su StringAlignmentNear.
  • L'ID lingua è impostato su lingua neutrale, il che significa che viene utilizzata la lingua corrente associata al thread chiamante.
  • La sostituzione delle cifre di stringa è impostata su StringDigitSubstituteUser.
  • Il prefisso della chiave di scelta rapida è impostato su HotkeyPrefixNone.
  • Il numero di tabulazioni è impostato su zero.
  • La stringa di taglio è impostata su StringTrimmingNone.

Esempio

Nell'esempio seguente viene creato un oggetto StringFormat generico e tipografico e quindi lo usa per disegnare una stringa formattata. Il codice disegna anche il rettangolo di layout della stringa.

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

Requisiti

Requisito Valore
Client minimo supportato Windows XP, Windows 2000 Professional [solo app desktop]
Server minimo supportato Windows 2000 Server [solo app desktop]
Piattaforma di destinazione Windows
Intestazione gdiplusstringformat.h (include Gdiplus.h)
Libreria Gdiplus.lib
DLL Gdiplus.dll

Vedi anche

Carattere

HotkeyPrefix

LOGFONT

RectF

StringAlignment

StringDigitSubstitute

StringFormat

StringFormatFlags

StringTrimming