DirectDraw clearing the screen

snarfblam

Ultimate Contributor
Joined
Jun 10, 2003
Messages
2,097
Location
USA
I am making a program that uses directdraw fullscreen. The screen doesnt redraw every frame, it makes any changes to the screen on the primary surface as they are needed.

When the program starts up, it draws the initial screen on the primary surface.

Here is the problem: Sometimes, when the image comes back on the screen, the screen is blank, just the backcolor of my target form. I am not sure why this happens. My best guess is that I am drawing it too early.

If I am right, and I don't know if I am, then the solution would be to have the program wait until the resolution has changed and all ready for drawing.

Here is the question: Does anyone know how, if possible, you can detect when directx is ready for drawing?
 
Note: I know this thread is old, but someone may have a related question in the future.

You can check that your owner control is created by testing the Control.Created property. This seems to be common practice among sample code that I've seen. But it sounds like your surface is being lost, which you can check through a try/catch block and catching the SurfaceLostException. When this happens, try to restore the surface and redraw it.
 
Back
Top