void CShowStringView::OnDraw(CDC* pDC)
{
CShowStringDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
COLORREF oldcolor;
switch (pDoc->GetColor())
{
case 0:
oldcolor = pDC->SetTextColor(RGB(0,0,0));break;
case 1:
oldcolor = pDC->SetTextColor(RGB(0xFF,0,0));break;
case 2:
oldcolor = pDC->SetTextColor(RGB(0,0xFF,0));break;
}
// pDC->SetTextColor(oldcolor); 这个函数放到这为什么不行,而去掉或放到倒数第二行就行
CRect rect;
GetClientRect(&rect);
pDC->DrawTextW(pDoc->GetString(),&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
pDoc->SetModifiedFlag();
}