Implementation of special fonts in VC

xiaoxiao2021-03-06  18

Implementation of special fonts in VC ü Font: Gradient word, hollow word, stereo word, rotary word gradient word: // Get window of customer area device context handle CClientDC DC (this); // Change the current font logfont lf; dc.getCurrentFont () -> getLogFont; 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); // Changing 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 -) {IRADIUS = (600 * i) / 255; dc.selectObject (Poldbrush) Br.deleteObject (); br.createsolidbrush (RGB (255, i, 0)); dc.selectObject (& br); dc.ellipse Iradius, -iradius / 3, iRadius, Iradius / 3);} // Recovery device contextual settings dc.selectObject (PoldFont); dc.selectObject (Poldbrush); hollow word: // Get the window's client area device context handle CClientDC DC (this); / / Change the current font logfont lf; dc.getCurrentFont () -> getLogFont (& lf); cfont font; cfont * PoldFont; // Save device context initially used Object 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 path dc.strokePath (); // Restore the original settings of the device context Dc.selectObject (PoldFont); Dc.SelectObject (PoldPen); Stereome Word: Generally does not use the default font settings when implementing 3D text, but through the setting of the font, the generated 3D text is visually more beautiful // obtains the window of the client area device context handle CclientDC DC (this); / / Define font attribute logfont lf; lf.lfheight = 50; lf.lfwidth = 0; lf.lFescapement = 0; lf.lForientation = 0; lf.lfweight = false; lf.lfital = false; lf.lfunderline = false; Lf.lfstrikeout = false; lf.lfcharset = GB2312_CHARSET; STRCPY (LF.LFFAname, "Young Round"); // Create font cfont font; font.createfontIndirect (& lf); // Change the current font cfont * PoldFont = dc.selectObject (& font); // Draw font dc.setbkmode (transparent); dc.setTextColor (: getSyscolor (Color_3ddkshad) OW); DC.Textout (10, 10, "stereo"); dc.settextColor (:: getSyscolor (color_3dhilight)); dc.textout (13, 7, "stereo words"); // Restore device context Original setting dc.selectObject (PoldFont); Rotating word: Cable CclientDC DC (this); // by setting the tilt angle of the font and the X-axis (one tenth of one) // obtains the window. Define font attributes logfont lf; lf.lfheight = 50; lf.lfwidth = 0; lf.lfescapement = 300; // tilted 30 degrees, one-tenth of one in unit Lf.LForientation = 0; lf.lfWeight = fw_heavy; lf .lfitalic = false; lf.lfunderline = false; lf.lfstrikeout = false; lf.lfcharset = GB2312_CHARSET

STRCPY (LF.LFFCENAME, "Young Round"); // Create 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)); DC.TextOut (10,300, "rotating font"); // Restore the original settings of DC.selectObject (PoldFont); Author Blog:

http://blog.9cbs.net/huuyoo/

Transfer from:

http://dev.9cbs.net/Article/49/Article/47/47006.shtm

ü Font: Gradient word, hollow word, stereo word, rotary word gradient word: // get the window's client area device context handle 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); // Changing 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-) {IRADIUS = (600 * i) / 255; dc.selectObject (Poldbrush); br.deleteObject () Br.Createsolidbrush (RGB (255, i, 0)); Dc.SelectObject (& Br); dc.ellipse (-iradius, Iradius / 3, Iradius, Iradius / 3);} // Recovery device contextual setting dc.selectObject (PoldFont); dc.selectObject (Poldbrush); hollow word: // get window Customer Device Context Handle CClientDC DC (this); / / Change the current font logfont lf; dc.getCurrentFont () -> getLogFont (& lf); cfont font; cfont * PoldFont; // Save the device The above-mentioned font object 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 path dc.strokePath (); // Restore the original settings of the device context Dc.selectObject (PoldFont); Dc.SelectObject (PoldPen); Stereome Word: Generally does not use the default font settings when implementing 3D text, but through the setting of the font, the generated 3D text is visually more beautiful // obtains the window of the client area device context handle CclientDC DC (this); / / Define font attribute logfont lf; lf.lfheight = 50; lf.lfwidth = 0; lf.lFescapement = 0; lf.lForientation = 0; lf.lfweight = false; lf.lfital = false; lf.lfunderline = false; Lf.lfstrikeout = false; lf.lfcharset = GB2312_CHARSET; STRCPY (LF.LFFAname, "Young Round"); // Create font cfont font; font.createfontIndirect (& lf); // Change the current font cfont * PoldFont = dc.selectObject (& font); // Draw font dc.setbkmode (transparent); dc.setTextColor (: getSyscolor (Color_3ddkshad) OW); DC.Textout (10, 10, "stereo"); dc.settextColor (:: getSyscolor (color_3dhilight)); dc.textout (13, 7, "stereo words"); // Restore device context Original setting dc.selectObject (PoldFont); Rotating word: Cable CclientDC DC (this); // by setting the tilt angle of the font and the X-axis (one tenth of one) // obtains the window. Define font attributes logfont lf; lf.lfheight = 50; lf.lfwidth = 0; lf.lfescapement = 300; // tilted 30 degrees, one-tenth of one in unit Lf.LForientation = 0; lf.lfWeight = fw_heavy; lf .lfitalic = false; lf.lfunderline = false; lf.lfstrikeout = false; lf.lfcharset = GB2312_CHARSET

STRCPY (LF.LFFCENAME, "Young Round"); // Create 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)); DC.TextOut (10,300, "rotating font"); // Restore the original settings of DC.selectObject (PoldFont); Author Blog:

http://blog.9cbs.net/huuyoo/

Transfer from:

http://dev.9cbs.net/Article/49/Article/47/47006.shtm

转载请注明原文地址:https://www.9cbs.com/read-44144.html

New Post(0)