Bloom.CollectionTab.LibraryView.BackgroundColorsForLinux C# (CSharp) Method

BackgroundColorsForLinux() private method

private BackgroundColorsForLinux ( ) : void
return void
        private void BackgroundColorsForLinux()
        {
            // Set the background image for Mono because the background color does not paint,
            // and if we override the background paint handler, the default styling of the child
            // controls is changed.

            // We are getting an exception if none of the buttons are visible. The tabstrip is set
            // to Dock.Top which results in the height being zero if no buttons are visible.
            if ((_toolStrip.Height == 0) || (_toolStrip.Width == 0)) return;

            var bmp = new Bitmap(_toolStrip.Width, _toolStrip.Height);
            using (var g = Graphics.FromImage(bmp))
            {
                using (var b = new SolidBrush(_toolStrip.BackColor))
                {
                    g.FillRectangle(b, 0, 0, bmp.Width, bmp.Height);
                }
            }
            _toolStrip.BackgroundImage = bmp;
        }