I have C# app, but the painting job is done within C++ project (this is how it has to be).
So I added to my window PictureBox, and passed the handle to the drawing function. It works fine.
However when the control is invalidated (I move the window outside the screen and then move it back), I get in result partially empty window. AFAIK there are two approaches for this -- repaint or cache the image.
Repainting could be costly process (the image does not change often, but processing is time consuming, think of 3d renderer), so I would like to simply cache the image.
If I remember correctly from old days of programming directly with Win32 API all it takes is to set some flags. Is it possible with WinForms? If yes, how?
This will help:
If you know when the surface has been refreshed you can use it like this:
The only catch is that the
PictureBoxactually must be completely visible on the screen!