I am trying to draw text on the screen in a fast speed. The drawing is triggered by a timer constantly.
In the painting routine, I have to get a DC, select fonts and colors, and then release the DC and unselect the fonts.
This is done everytime the timer is triggered, which makes the drawing way too slow.
I am wondering if there is a way the CDC can be saved and used later. Thanks.

Here is what I am doing now:

void MyClass::OnTimer(...)
{
PaintText();
}

void MyClass::PaintText()
{
CDC *pDC=GetDC();
CFont *pOld;
pOld = pDC->SelectObject(font);
pDC->SetTextColor(txtColor);
pDC->SetBkColor(bkColor);

pDC->TextOut(......);

pDC->SelectObject(pOld);
ReleaseDC(pDC);
}