1. Text Format
// Create a new font
LOGFONT log; // struct variable
CFont font; // font object
// Set attributes
Log. lfCharSet = ANSI_CHARSET;
Log. lfClipPrecision = 23; // specifies the font cropping precision.
Log. lfEscapement = 0; // the tilt of the font relative to the X axis is 0.
Log. lfHeight = 50; // The font height is 50.
Strcpy (log. lfFaceName, "new font"); // font name
Log. lfItalic = 0; // 0 indicates non-italic
Log. lfOrientation = 900; // The angle between the font baseline and the X axis
Log. lfOutPrecision = 90; // The output precision of the font.
Log. lfPitchAndFamily = 0; // Character Spacing
Log. lfQuality = 90; // font Output Quality
Log. lfUnderline = 0; // No underline
Log. lfStrikeOut = 0; // No strikethrough
Font. CreateFontIndirect (& log); // create a font
PDC-> SelectObject (& font); // select the device Environment
// Set alignment
PDC-> SetTextAlign (TA_CENTER );
// Set the output mode
PDC-> SetBkMode (TRANSPARENT );
// Set the Character spacing to 0
PDC-> SetTextCharacterExtra (0 );
PDC-> TextOut (130,100, "style 1 ");
// Set the Character spacing to 10.
PDC-> SetTextCharacterExtra (10 );
PDC-> TextOut (130,150, "Style 2 ");
2. Text Output Functions
PDC-> SetTextColor (RGB (200,0, 0 ));
Int nTab [] = {100 };
PDC-> TabbedTextOut (100, 50, "gl \ thh \ tgp", 3, nTab );
PDC-> TextOut (100,90, "this is TesOout ");
PDC-> ExtTextOut (100,130, ETO_CLIPPED, CRect (100,130,300,300), "tHis is ExTextOut", NULL );
PDC-> DrawText ("This is DrawText", CRect (100,180,300,300), DT_WORDBREAK );