Re: Direct3D in a usercontrol

chrisfoster_at_btinternet.com
Date: 12/14/04


Date: 14 Dec 2004 05:56:01 -0800

Thanks for your replies.

I think I have just fixed it. It may not be the best solution but here
it is. Sorry about the formatting, google seems to strip out the
indentation.

...

d.DeviceResizing += new CancelEventHandler(d_DeviceResizing);

private static void d_DeviceResizing(object sender, CancelEventArgs
e)
{
e.Cancel = true;
}

private void Viewer_Resize(object sender, System.EventArgs e)
{
if(device == null) return;

PresentParameters pp = new PresentParameters();
pp.BackBufferWidth = this.Width;
pp.BackBufferHeight = this.Height;
pp.SwapEffect = SwapEffect.Discard;
pp.Windowed = true;
device.Reset(pp);
}

...

I have briefly looked into swapchains but don't yet understand why I
need them.