mfcdrawtexttextout

MFC, Determine the drawText/TextOut is be covered by other window


I have develop a application, which user interface like a follow picture,

Original Picture

Now I open control panel window to covered the application window, like a follow picture,

cover picture

when I close the control panel window,

close contrl panel window

the text which is use DrawText/TextOut function to paint,

will be erase,

How do I determine the situation, when the text be erase....


Solution

  • This means that your DrawText and other painting functionality is written in the wrong place. You must do it in OnPaint or OnEraseBkgnd so that they are always painted (when other window overlaps, on resizing etc).

    Also, you must make sure that you are correctly creating (CreateDC) & releasing the device context (ReleaseDC) of each object.