P
P
pixik2015-02-02 20:09:26
C++ / C#
pixik, 2015-02-02 20:09:26

How to get rid of form flickering when redrawing a form in MFC?

In the project, I execute OnPaint(), draw all sorts of rectangles. After Invalidate(), the form starts to flicker (Invalidate() is performed to redraw the caption under the mouse). I read that they cope with the help of double buffering, but I did not understand how this can be implemented with little bloodshed.
Please teach or kick in the right direction :) I would be very grateful! :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AxisPod, 2015-02-03
@pixik

Look for MemoryDC / MemDC, there are a lot of implementations on the Internet. For example: www.cs.unc.edu/~stotts/145/homes/bball/online_code...
You draw everything there, and in the destructor it will spit everything out as a single Bitmap.

A
Armenian Radio, 2015-02-02
@gbg

  • To draw on bitmap, on the timer this bitmap to draw in the form.
  • Bury the dead MFC, change to Qt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question