public override void ToggleFullScreen(IntPtr handle) { //if (LostDevice != null) // LostDevice(); factory.SetWindowAssociation(handle, SlimDX.DXGI.WindowAssociationFlags.IgnoreAll); SwapChain.Dispose(); backBuffer.Dispose(); RenderView.Dispose(); SwapChain = new SlimDX.DXGI.SwapChain(factory, Device10, new SlimDX.DXGI.SwapChainDescription { BufferCount = 1, ModeDescription = new SlimDX.DXGI.ModeDescription(View.ClientSize.Width, View.ClientSize.Height, new Rational(60, 1), SlimDX.DXGI.Format.R8G8B8A8_UNorm), IsWindowed = false, OutputHandle = handle, SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0), SwapEffect = SlimDX.DXGI.SwapEffect.Discard, Usage = SlimDX.DXGI.Usage.RenderTargetOutput, Flags = SlimDX.DXGI.SwapChainFlags.AllowModeSwitch }); backBuffer = SlimDX.Direct3D10.Texture2D.FromSwapChain <SlimDX.Direct3D10.Texture2D>(SwapChain, 0); RenderView = new SlimDX.Direct3D10.RenderTargetView(Device10, backBuffer); //Create(handle); //SwapChain.SetFullScreenState(true, null); //if (ResetDevice != null) // ResetDevice(); }
static void CleanUpDevice() { if (!_Device.ImmediateContext.Disposed) { _Device.ImmediateContext.ClearState(); } if (!_VertexBuffer.Disposed) { _VertexBuffer.Dispose(); } if (!_LayOut.Disposed) { _LayOut.Dispose(); } if (!_VertexShader.Disposed) { _VertexShader.Dispose(); } if (!_PixelShader.Disposed) { _PixelShader.Dispose(); } if (!_ViewRenderTarget.Disposed) { _ViewRenderTarget.Dispose(); } if (!_SwapChain.Disposed) { _SwapChain.Dispose(); } if (!_Device.ImmediateContext.Disposed) { _Device.ImmediateContext.Dispose(); } if (!_Device.Disposed) { _Device.Dispose(); } }