public static Bitmap GetBackground(Color innerBorder, Color outerBorder, int width, IPaintingService painting)
        {
            Bitmap back = new Bitmap(width, width);

            using (Graphics gfx = Graphics.FromImage(back))
            {
                SolidBrush brush  = painting.GetBrush(innerBorder);
                SolidBrush brush2 = painting.GetBrush(outerBorder);
                gfx.FillRectangle(brush2, 0, 0, width, width);
                gfx.FillRectangle(brush, 1, 1, width - 2, width - 2);
            }

            return(back);
        }
        /// <summary>
        /// Gets images for docking indicators.
        /// </summary>
        /// <returns></returns>
        public static Bitmap GetDockIcon(Bitmap maskArrow, Bitmap layerArrow, Bitmap maskWindow, Bitmap layerWindow, Bitmap maskBack, Color background, IPaintingService painting, Bitmap maskCore = null, Bitmap layerCore = null, Color?separator = null)
        {
            var    width    = maskBack.Width;
            var    height   = maskBack.Height;
            var    rect     = new Rectangle(0, 0, width, height);
            Bitmap arrowOut = null;

            if (maskArrow != null)
            {
                Bitmap input = layerArrow;
                arrowOut = MaskImages(input, maskArrow);
            }

            Bitmap windowIn  = layerWindow;
            Bitmap windowOut = MaskImages(windowIn, maskWindow);

            Bitmap coreOut = null;

            if (layerCore != null)
            {
                var coreIn = layerCore;
                coreOut = MaskImages(coreIn, maskCore);
            }

            Bitmap backIn = new Bitmap(width, height);

            using (Graphics gfx = Graphics.FromImage(backIn))
            {
                SolidBrush brush = painting.GetBrush(background);
                gfx.FillRectangle(brush, 0, 0, width, height);
                gfx.DrawImageUnscaled(windowOut, 0, 0);
                windowOut.Dispose();
                if (layerCore != null)
                {
                    gfx.DrawImageUnscaled(coreOut, 0, 0);
                    coreOut.Dispose();
                }

                if (separator != null)
                {
                    Pen sep = painting.GetPen(separator.Value);
                    gfx.DrawRectangle(sep, 0, 0, width - 1, height - 1);
                }
            }

            Bitmap backOut = MaskImages(backIn, maskBack);

            backIn.Dispose();

            using (Graphics gfx = Graphics.FromImage(backOut))
            {
                if (arrowOut != null)
                {
                    gfx.DrawImageUnscaled(arrowOut, 0, 0);
                    arrowOut.Dispose();
                }
            }

            return(backOut);
        }
        public static Bitmap GetLayerImage(Color color, int width, IPaintingService painting)
        {
            Bitmap back = new Bitmap(width, width);

            using (Graphics gfx = Graphics.FromImage(back))
            {
                SolidBrush brush = painting.GetBrush(color);
                gfx.FillRectangle(brush, 0, 0, width, width);
            }

            return(back);
        }
        public static Bitmap GetLayerImage(Color color, int width, IPaintingService painting)
        {
            Bitmap back = new Bitmap(width, width);
            using (Graphics gfx = Graphics.FromImage(back))
            {
                SolidBrush brush = painting.GetBrush(color);
                gfx.FillRectangle(brush, 0, 0, width, width);
            }

            return back;
        }
        /// <summary>
        /// Gets images for docking indicators.
        /// </summary>
        /// <returns></returns>
        public static Bitmap GetDockIcon(Bitmap maskArrow, Bitmap layerArrow, Bitmap maskWindow, Bitmap layerWindow, Bitmap maskBack, Color background, IPaintingService painting, Bitmap maskCore = null, Bitmap layerCore = null, Color? separator = null)
        {
            var width = maskBack.Width;
            var height = maskBack.Height;
            var rect = new Rectangle(0, 0, width, height);
            Bitmap arrowOut = null;

            if (maskArrow != null)
            {
                Bitmap input = layerArrow;
                arrowOut = MaskImages(input, maskArrow);
            }

            Bitmap windowIn = layerWindow;
            Bitmap windowOut = MaskImages(windowIn, maskWindow);

            Bitmap coreOut = null;
            if (layerCore != null)
            {
                var coreIn = layerCore;
                coreOut = MaskImages(coreIn, maskCore);
            }

            Bitmap backIn = new Bitmap(width, height);
            using (Graphics gfx = Graphics.FromImage(backIn))
            {
                SolidBrush brush = painting.GetBrush(background);
                gfx.FillRectangle(brush, 0, 0, width, height);
                gfx.DrawImageUnscaled(windowOut, 0, 0);
                windowOut.Dispose();
                if (layerCore != null)
                {
                    gfx.DrawImageUnscaled(coreOut, 0, 0);
                    coreOut.Dispose();
                }

                if (separator != null)
                {
                    Pen sep = painting.GetPen(separator.Value);
                    gfx.DrawRectangle(sep, 0, 0, width - 1, height - 1);
                }
            }

            Bitmap backOut = MaskImages(backIn, maskBack);
            backIn.Dispose();

            using (Graphics gfx = Graphics.FromImage(backOut))
            {
                if (arrowOut != null)
                {
                    gfx.DrawImageUnscaled(arrowOut, 0, 0);
                    arrowOut.Dispose();
                }
            }

            return backOut;
        }
        public static Bitmap GetBackground(Color innerBorder, Color outerBorder, int width, IPaintingService painting)
        {
            Bitmap back = new Bitmap(width, width);
            using (Graphics gfx = Graphics.FromImage(back))
            {
                SolidBrush brush = painting.GetBrush(innerBorder);
                SolidBrush brush2 = painting.GetBrush(outerBorder);
                gfx.FillRectangle(brush2, 0, 0, width, width);
                gfx.FillRectangle(brush, 1, 1, width - 2, width - 2);
            }

            return back;
        }