protected virtual void Dispose(bool _bDisposeManagedResources) { if (_bDisposeManagedResources) { UnloadResources(); m_RenderingSurface.Dispose(); m_RenderingSurface2.Dispose(); m_D2DContext.Dispose(); dataStream.Dispose(); } m_RenderingSurface = null; m_RenderingSurface2 = null; m_D2DContext = null; dataStream = null; }
public void Initialize(Control surface, Control surfaceFullScreen) { try { // Create the rendering surface from the control. m_RenderingSurface = new Control(); m_RenderingSurface2 = new Control(); m_RenderingSurface = surface; m_RenderingSurface2 = surfaceFullScreen; // Initialize the Direct2D rendering context. DeviceSettings settings = new DeviceSettings() { Width = surface.ClientSize.Width, Height = surface.ClientSize.Height }; DeviceSettings settingsFullScreen = new DeviceSettings() { Width = surfaceFullScreen.ClientSize.Width, Height = surfaceFullScreen.ClientSize.Height }; m_D2DContext = new DXD2D1(); m_D2DContext.InitScreen1(surface.Handle); m_D2DContext.InitScreen2(surfaceFullScreen.Handle, settingsFullScreen); InitSurfaceSize(); LoadResources(); } catch (Exception ex) { Logger.LogFile(ex.Message, "", "Initialize", ex.LineNumber(), "GraphicUtilDX"); } }