CView OnDraw:设置字体,设置背景色,设置输出文字颜色,居中输出
// TODO: add draw code for native data here
CDocument* pDoc = GetDocument();
CPaintDC* dc = (CPaintDC*)pDC;
CRect rect;
CBrush brush;
brush.CreateSolidBrush(RGB(150,150,150));
this->GetClientRect(&rect);
dc->FillRect(&rect, &brush);
brush.DeleteObject();
CFont font;
font.CreateFont(
50, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS,
_T("Arial") // nPitchAndFamily Arial
);
pDC->SelectObject(&font);
SetBkColor(pDC->m_hDC, RGB(150,150,150));
//SetBkMode(pDC->m_hDC, TRANSPARENT);
SetTextColor(pDC->m_hDC, RGB(255,0,0));
CString tout = "No Video!\nNo webcam or only one webcam!";
CRect temp = rect;
int height = pDC->DrawText(tout, temp, DT_CENTER | DT_WORDBREAK | DT_EDITCONTROL | DT_CALCRECT);
rect.DeflateRect(0, (rect.Height() - height)/2);// change rect
pDC->DrawText(tout, rect, DT_CENTER | DT_WORDBREAK | DT_EDITCONTROL); //