Friday, February 5, 2016

MFC OnPaint refresh draw Flickering

The best way to stop flickering is to have another member variable, and to redraw only when necessary. For instance, I chance the cursor every now but that can cause significant redrawing. Using an extra variable, I only redraw when necessary.

void COGraphCtrl::OnPaint()
{
   if(m_RePaint)
   {
           CPaintDC dc(this);

      dc.FillSolidRect(&clientRect,RGB(255,255,255));