CPaintDC class



Hi there,

I have some form drawing code that uses the CPaintDC class and it works
fine. But I am just wondering if it is as good as using BeginPaint and
EndPaint.

I know this class calls these 2 methods anyway, but I am unsure as to
whether it takes in for account the invalid rectangle whilst calling it's
BitBlt method.

For example, if I declare "CPaintDC dc(myWindowHandle)" and the paint
event args specify that only a small portion of the entire surface is to be
repainted does BitBlt only paint said region?

------

Let's say only the rectangle (100,100,150,150) needs repainting....

------

CPaintDC dc(m_hWnd);
CRect rc; GetClientRect(&rc);

//Clear the buffer
m_memDC.FillRect(&rc,m_bkgrnd);

//Draw to the buffer here
...

//Blit the buffer
dc.BitBlt(rc.left,
rc.top,
rc.right,
rc.bottom,
m_memDC,
rc.left,
rc.top,
SRCCOPY);

------

Does BitBlt actual perform a block copy of the entire rectangle
specified, or only the one that is specified in the paint arguments?

Thanks loads in advance!

Nick.


.


Loading