Screen refresh problem when exiting managed directdraw windows
- From: wp1@xxxxxxxxxx
- Date: 5 Oct 2006 03:36:29 -0700
Hi all
I am trying some simple managed directdraw code in C# (VS2005,
DirectX9sdk) but encouter some troubles when closing my windows (form).
It is a testing application with some kind of "Menu form" where a
button open a new Form in which I initialise a directdraw device and
jus fill a secondary surface with one color & flip it to a primary
surface for displaying each time a key is pressed.
here is what I am doing :
ssurface.ColorFill(Color.Blue ); //fill the backbuffer ( secondary
Surface ) with a color
psurface.Flip(ssurface, FlipFlags.DoNotWait); //flip the backbuffer to
the front
When I do this operation only one time and then I exit the windows
everything is OK I'm back on my remaining Menu form.
But if this operation is done twice or more, when I close the
"directdraw form" the screen is not refreshed and I can only see the
frame of the menu form (or of all the other opened windows) and I have
to move my mouse over it to make the differents controls be refreshed
(and become visible). Then when I click on my "Quit buttton",
everything (all the other windows)is refreshed and ok.
What's happening ? Is there any way to force the refresh of all opened
windows.
thanks in advance for any help!
Sylvain Clément
------------
Here is some piece of my code :
// initialize DirectDraw :
dddevice = new Microsoft.DirectX.DirectDraw.Device(); // Creating
Device Object
dddevice.SetCooperativeLevel(this,
CooperativeLevelFlags.FullscreenExclusive );
// prepare front & back buffer
sdesc.SurfaceCaps.Complex = true;
sdesc.BackBufferCount = 1;
psurface = new Surface(sdesc, dddevice);
psurface.Clipper = clip;
sdesc.Clear();
sdesc.SurfaceCaps.BackBuffer = true;
ssurface = psurface.GetAttachedSurface(sdesc.SurfaceCaps);
// fiil when the B key is pressed (same code for another key but with
a different color).
if (e.KeyCode == Keys.B)
{
ssurface.ColorFill(Color.Blue ); //fill the backbuffer
( secondary Surface ) with a color
psurface.Flip(ssurface, FlipFlags.DoNotWait); //flip
the backbuffer to the front
}
// closing the windows
dddevice.RestoreDisplayMode();
dddevice.SetCooperativeLevel(null, CooperativeLevelFlags.Normal);
psurface.Dispose();
ssurface.Dispose();
this.close();
.
- Prev by Date: display DXT5 in .net picture box
- Next by Date: How do I get just the DirectX 9.0c SDK?
- Previous by thread: display DXT5 in .net picture box
- Next by thread: How do I get just the DirectX 9.0c SDK?
- Index(es):
Relevant Pages
|