How to stop a CWnd flickers & tramble

I have created a control with 4 buttons & with drawing some
lines in the OnPaint. when pressing one of the buttons causes other buttons to move with the CWnd::MoveWindow().
The buttons move as expected but the control flickers and
trumbles while moving the button.
why is that and how can i correct it ???
Who is Participating?

Improve company productivity with a Business Account.Sign Up

chensuConnect With a Mentor Commented:
Apply the WS_CLIPCHILDREN style to your control window (the parent window of the buttons).
This is because when the button is moved, the parent window gets a WM_PAINT message, which causes the parent window to redraw, it clears the buttons, then the buttons are put back. Thus, you see it flicker.
The window flickering because it is slow to draw graph in Windows. Windows do not have direct access to the memory cells corresponding to the onscreen pixels, it processes the drawing statement through many layers of sofware. This process takes a long time time and results in the flickering.
Microsoft release the WinG library to help developing fast graphics operations with windows. It can be realized through a WinG OLE control.
Slow drawing does not cause flickering. Filickering is caused by drawing it, clearing it and drawing it again.

WinG is obsolete. Use DirectX if you want fast graphics operations.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.