Objective Grid: Decreasing flicker for a grid in a CView

Article ID: 312
Last updated: 11 Jun, 2018
Article ID: 312
Last updated: 11 Jun, 2018
Revision: 3
Views: 2159
Posted: 24 Jan, 2001
by Meltreger B.
Updated: 11 Jun, 2018
by Meltreger B.

Problem


We have embedded a grid window into a CView. Whenever the view is drawn, the grid window gets erased and we get a lot of flickering. What can we do?


Cause



Action


The problem is that the view will erase the grid in its OnEraseBkgnd() message. You should process this message and also override the OnPaint() message.

Example:

BOOL CWndView::OnEraseBkgnd(CDC* pDC)
{
return FALSE;
}

void CWndView::OnPaint()
{

CPaintDC dc(this); // device context for painting

// Erase everything but not the grid
CRect rectGrid;
m_pMeasTable->GetWindowRect(rectGrid);
ScreenToClient(&rectGrid);
dc.ExcludeClipRect(rectGrid);
CRect rectClient;
GetClientRect(rectClient);
GXPatB(&dc, rectClient, ::GetSysColor(COLOR_WINDOW));

}

Also take a look at the other article "Decreasing update flicker"

This article was:   Helpful | Not helpful
Report an issue
Article ID: 312
Last updated: 11 Jun, 2018
Revision: 3
Views: 2159
Posted: 24 Jan, 2001 by Meltreger B.
Updated: 11 Jun, 2018 by Meltreger B.

Others in this category