📄 readme.wzd
字号:
/////////////////////////////////////////////////////////////////////
// Modify any class that can draw to a window.
/////////////////////////////////////////////////////////////////////
CString str("This is drawn text.");
// 1) use a stock font
pDC->SelectStockObject(ANSI_VAR_FONT);
// 2) set text color
pDC->SetTextColor(RGB(100,100,100));
// 3) set background mode to transparent (no background color)
pDC->SetBkMode(TRANSPARENT);
// 4) set text alignment
pDC->SetTextAlign(TA_LEFT|TA_TOP); //default: also TA_BASELINE,TA_BOTTOM,TA_CENTER,TA_RIGHT
// 5) draw text to window
pDC->TextOut(100,100, str, str.GetLength());
// 6) create your own font (8 point, MS Sans Serif)
CFont font;
font.CreateFont(-22, 0, 0, 0, FW_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0,
"Courier");
// 7) select font into a device context
CFont *pFont = (CFont *)pDC->SelectObject(&font);
: : (draw text) : :
pDC->SelectObject(pFont);
// 8) select font into a window (will be defualt window font)
pWnd->SetFont(&font);
// 9) set background mode to transparent (use background color)
pDC->SetBkMode(OPAQUE);
// 10) set background color (drawn behind text)
pDC->SetBkColor(RGB(200,200,200));
// 11) draw formatted text
CRect rect(100,150,400,500); //clips text outside of this rectangle
pDC->DrawText(str,rect,DT_CENTER);
/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1998 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -