tags:

views:

79

answers:

2

I'm writing an MDI app using Managed dx9.

When I create the Device, I pass in a control.

If I pass in one of the MDI child windows (or more specifically, a control in the MDI child window), everything renders fine. I can spawn new child MDI windows and draw to each of these individually. I can close any of the new windows, no problem. But if I close the original child window, Device.Clear() throws an exception (null reference exception - the Device has been disposed).

Alternatively, I can pass Form1 to the Device constructor. Now I can open and close as many child windows as I like without getting the exception, but now the render resolution isn't quite right - the graphics aren't as crisp as when I pass the child window to the Device constructor.

So my first questions are: Can I specify the resolution when I construct the device? Which control / window should I pass to the Device constructor? What am I doing wrong? :)

Thanks

Tim

A: 

I was unable to get the resolution to work when using the form as the control passed to the device constructor, so I recreated the device if it ever became disposed.

Tim Gradwell
+1  A: 

You should be aware that Managed DirectX is deprecated and will never be updated again by Microsoft. You should use SlimDX instead.

legalize