Share via


Método StringFormat::GenericDefault (gdiplusstringformat.h)

El método StringFormat::GenericDefault crea un objeto StringFormat genérico y predeterminado.

Sintaxis

const StringFormat * GenericDefault();

Valor devuelto

Tipo: StringFormat*

Este método devuelve un puntero al nuevo objeto StringFormat .

Comentarios

Un objeto StringFormat genérico y predeterminado tiene las siguientes características:

  • No se establecen marcas de formato de cadena.
  • La alineación de caracteres y la alineación de líneas se establecen en StringAlignmentNear.
  • El identificador de idioma se establece en idioma neutro, lo que significa que se usa el idioma actual asociado al subproceso que realiza la llamada.
  • La sustitución de dígitos de cadena se establece en StringDigitSubstituteUser.
  • El prefijo de clave activa se establece en HotkeyPrefixNone.
  • El número de tabulaciones se establece en cero.
  • El recorte de cadenas se establece en StringTrimmingCharacter.

Ejemplos

En el ejemplo siguiente se crea un objeto StringFormat genérico predeterminado y, a continuación, se usa para dibujar una cadena con formato. El código también dibuja el rectángulo de diseño de la cadena.

VOID Example_GenericDefault(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 StringFormat object.
   const StringFormat* pStringFormat = StringFormat::GenericDefault();

   // Use the generic StringFormat object in a call to DrawString.
  graphics.DrawString(
      L"This text was formatted by a generic StringFormat object.", 
      57,  // 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);
}

Requisitos

   
Cliente mínimo compatible Windows XP, Windows 2000 Professional [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows 2000 Server [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado gdiplusstringformat.h (include Gdiplus.h)
Library Gdiplus.lib
Archivo DLL Gdiplus.dll

Consulte también

Fuente

HotkeyPrefix

LOGFONT

RectF

StringAlignment

StringDigitSubstitute

StringFormat

StringFormatFlags

StringTrimming