コード例 #1
0
        /// <summary>
        /// Disposes the control.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (graphicsDeviceService != null)
            {
                graphicsDeviceService.Release(disposing);
                graphicsDeviceService = null;
            }

            base.Dispose(disposing);
        }
コード例 #2
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        protected override void OnCreateControl()
        {
            // Don't initialize the graphics device if we are running in the designer.
            if (!DesignMode)
            {
                graphicsDeviceService = new GraphicsDeviceService(Handle,
                    ClientSize.Width, ClientSize.Height);

                // Give derived classes a chance to initialize themselves.
                Initialize();

                graphics.Device = graphicsDeviceService.GraphicsDevice;
                graphics.InitializeDevice();

                PreviewKeyDown += new PreviewKeyDownEventHandler(GraphicsDeviceControl_PreviewKeyDown);
            }

            base.OnCreateControl();
        }