With every timer event we start the following code which does all the painting. The only magic for the flicker free painting is the use of the Class CMemDC
void CFlickerFreeDemoDlg::OnPaint() { CPaintDC dc(this); CRect rc_dest; GetClientRect(&rc_dest); CRect rc_source=rc_dest; CMemDC pDC(&dc,&rc_source, &rc_dest); // Double Buffering PlotToDC(& pDC); // Do the painting } void CFlickerFreeDemoDlg::PlotToDC(CMemDC* pDC) { CRect rect; GetClientRect(&rect); int delta_x = rect.right - rect.left; int delta_y = rect.bottom - rect.top; COLORREF color; for (int x=0; x< delta_x; x++) { for (int y=0; y< delta_y; y++) { color = PixelArray.m_Array[x][y]; pDC->SetPixel(x,y,color); } } } |
What exactly do you want to see?
I would like to see a continuation of the topic