ü Font: gradient word, hollow word, stereo word, rotating word
Gradient word:
// Get the client area device context of the window
CClientDC DC (this);
/ / Change the current font
Logfont LF;
Dc.getCurrentFont () -> GetLogFont (& lf);
CFONT FONT, * POLDFONT;
Lf.lfcharset = 134;
Lf.lfheight = -150;
Lf.lfwidth = 0;
STRCPY (LF.LFFACENAME, "Lishu");
Font.createFontIndirect (& lf);
PoldFont = Dc.selectObject (& font);
Dc.setbkmode (transparent);
/ / Change the current brush is empty
CPEN PEN (PS_NULL, 1, RGB (255, 0, 0)), * PoldPen;
Poldpen = dc.selectObject (& pen);
/ / Change the current brush
CBRUSH Br, * Poldbrush;
Poldbrush = dc.selectObject (& br);
// Start a path
Dc.beginpath ();
DC.Textout (10, 10, "Gradient");
Dc.Endpath ();
// Draw gradient effect
Dc.selectclippath (RGN_COPY);
For (int i = 255; i> 0; I -)
{
INT IRADIUS = (600 * i) / 255;
Dc.selectObject (Poldbrush);
Br.DeleteObject ();
Br.createsolidbrush (RGB (255, i, 0));
Dc.SelectObject (& Br);
Dc.ellipse (-iradius, -iradius / 3, iradius, iracius / 3);
}
/ / Restore the original settings of the device context
Dc.selectObject (PoldFont);
Dc.selectObject (Poldpen);
Dc.selectObject (Poldbrush);
Hollow word:
// Get the client area device context of the window
CClientDC DC (this);
/ / Change the current font
Logfont LF;
Dc.getCurrentFont () -> GetLogFont (& lf);
CFONT font;
CFont * PoldFont; / / Save the font object that initially used in the device
Lf.lfcharset = 134;
Lf.lfheight = -150;
Lf.lfwidth = 0;
STRCPY (LF.LFFACENAME, "Lishu");
Font.createFontIndirect (& lf);
PoldFont = Dc.selectObject (& font);
Dc.setbkmode (transparent);
/ / Change the current brush
CPEN PEN (PS_SOLID, 1, RGB (255, 0, 0));
CPEN * POLDPEN;
Poldpen = dc.selectObject (& pen);
// Start a path
Dc.beginpath ();
Dc.TextOut (10, 130, "hollow word");
Dc.Endpath ();
// Draw the path
DC.STROKEPATH ();
/ / Restore the original settings of the device context
Dc.selectObject (PoldFont);
Dc.selectObject (Poldpen);
Stereo: Generally does not use the default font settings when implementing 3D text, but by setting the 3D text generated in the font, the 3D text is visually more beautiful // obtains the window of the window device context handle
CClientDC DC (this);
/ / Define font properties
Logfont LF;
Lf.lfheight = 50;
Lf.lfwidth = 0;
Lf.LFEScapement = 0;
Lf.LForientation = 0;
Lf.lfweight = fw_heavy;
Lf.lfitalic = false;
Lf.lfunderline = false;
Lf.lfstrikeout = false;
Lf.lfcharset = GB2312_CHARSET;
STRCPY (LF.Lffacename, "Young Round");
// Create a font
CFONT font;
Font.createFontIndirect (& lf);
/ / Change the current font
CFont * PoldFont = DC.SelectObject (& font);
// Draw font
Dc.setbkmode (transparent);
Dc.SetTextColor (:: getSyscolor (color_3ddkshadow);
Dc.Textout (10, 10, "stereo words");
Dc.SetTextColor (:: getSyscolor (color_3dhilight));
Dc.Textout (13, 7, "stereo");
/ / Restore the original settings of the device context
Dc.selectObject (PoldFont);
Rotating word: By setting the inclination angle of the font and the x-axis (one-tenth of one is one unit)
// Get the client area device context of the window
CClientDC DC (this);
/ / Define font properties
Logfont LF;
Lf.lfheight = 50;
Lf.lfwidth = 0;
Lf.LFESCAPEMENT = 300; // Tilt 30 degrees, one tenth
Lf.LForientation = 0;
Lf.lfweight = fw_heavy;
Lf.lfitalic = false;
Lf.lfunderline = false;
Lf.lfstrikeout = false;
Lf.lfcharset = GB2312_CHARSET;
STRCPY (LF.Lffacename, "Young Round");
// Create a font
CFONT font;
Font.createFontIndirect (& lf);
/ / Change the current font
CFont * PoldFont = DC.SelectObject (& font);
// Draw font
Dc.setbkmode (transparent);
Dc.SetTextColor (RGB (255, 0, 0));
Dc.TextOut (10,300, "rotating font");
/ / Restore the original settings of the device context
DC
.
SelectObject
(
PoldFont
);