ARCed.Controls.GraphicsDeviceControl.BeginDraw C# (CSharp) Метод

BeginDraw() приватный метод

Attempts to begin drawing the control. Returns an error message string if this was not possible, which can happen if the graphics device is lost, or if we are running inside the Form designer.
private BeginDraw ( ) : string
Результат string
        string BeginDraw()
        {
            // If we have no graphics device, we must be running in the designer.
            if (this.graphicsDeviceService == null)
            {
                return Text + "\n\n" + GetType();
            }

            // Make sure the graphics device is big enough, and is not lost.
            string deviceResetError = this.HandleDeviceReset();

            if (!string.IsNullOrEmpty(deviceResetError))
            {
                return deviceResetError;
            }

            // Many GraphicsDeviceControl instances can be sharing the same
            // GraphicsDevice. The device backbuffer will be resized to fit the
            // largest of these controls. But what if we are currently drawing
            // a smaller control? To avoid unwanted stretching, we set the
            // viewport to only use the top left portion of the full backbuffer.
            var viewport = new Viewport
            {
                X = 0,
                Y = 0,
                Width = ClientSize.Width,
                Height = ClientSize.Height,
                MinDepth = 0,
                MaxDepth = 1
            };

            this.GraphicsDevice.Viewport = viewport;

            return null;
        }