If I ommit the Application.DoEvents() call, the app is working in fullscreen mode, but the OnKeyPress(KeyPressEventArgs e) is not working anymore since windows seems not to have any resources left vor event-handling.
If I turn on the Application.DoEvents() call, I get this error-message:
Error in the application.
-2005530516 (D3DERR_INVALIDCALL)
at Microsoft.DirectX.Direct3D.Device.Reset(PresentParameters[] presentationParameters)
at Microsoft.DirectX.Direct3D.Device.OnParentResized(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Form.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)