nav-left cat-right
Matthias Pospiech > Programming > C++ > MFC > Flicker Free example with dialog

Flicker Free example with dialog

One can find several examples for flicker free drawing in MFC. (see for example Flicker Free Drawing In MFC)

Here is an example done by myself. I used the CMemDC Class posted in Enhanced CMemDC.

The example code for download: (27,7 KiB)

What is the magic? We need to make sure, that the background of our window is not painted when OnPaint is called. For that we need to include the message ON_WM_ERASEBKGND() with the simple content in its function

BOOL CFlickerFreeDemoDlg::OnEraseBkgnd(CDC* pDC)
	return FALSE;
The painting is triggered with a timer initialised in OnInitDialog()
BOOL CFlickerFreeDemoDlg::OnInitDialog()
	SetTimer(1, 33, NULL);
void CFlickerFreeDemoDlg::OnTimer(UINT nIDEvent) 
Updateplot() is used to invalidate the window and trigger the OnPaint message
void CFlickerFreeDemoDlg::UpdatePlot()

Seiten: 1 2 3

2 Antworten : “Flicker Free example with dialog”

  1. What exactly do you want to see?

  2. Maximus sagt:

    I would like to see a continuation of the topic


  1. Matthias Pospiech :: MFC: Flicker Free example with CStatic Control - [...] It works very similar to the description of Flicker Free example with dialog. [...]

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.