Answer the question
In order to leave comments, you need to log in
How to organize drawing in a persistent memory context in MFC?
I want to make a Canvas class, inherited from CWnd, which would support my drawing methods.
I want to draw in memory, and in the OnPaint () handler, just copy the picture from the memory context to the CPaintDC context.
What classes to use to store the drawing context in memory, and how to initially initialize it? All the classes I found require that CPaintDC& in their constructor, but I want to paint in a memory context not in an OnPaint() handler.
Answer the question
In order to leave comments, you need to log in
CDC, initialize as CreateCompatibleDC from the final CClientDC
and CBitmap, create as CreateCompatibleBitmap from the same CClientDC and select into the created CDC.
Draw in CDC as usual, then copy from it using BitBlt.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question