Example #1
0
        /// <summary>
        /// Creates and paints the button bitmap of the virtual scrollbar.
        /// </summary>
        /// <param name="width">The width of the button.</param>
        /// <param name="height">The height of the button.</param>
        /// <returns>The button image.</returns>
        protected virtual Image CreateScrollButtonBitmap(int width, int height)
        {
            Bitmap bm = new Bitmap(width, height);
            using (Graphics g = Graphics.FromImage(bm))
            {
                int r = Math.Min(width, height / 2) - 1;
                if (r < 1) r = 1;

                backgroundBrush.Color = Color.Fuchsia;
                //g.Clear(Color.Fuchsia);
                g.FillRectangle(backgroundBrush, 0, 0, width, height);

                using (GraphicsPlus gp = new GraphicsPlus(g))
                {
                    Rectangle bounds = new Rectangle(0, 0, width - 1, height - 1);
                    gp.SmoothingMode = SmoothingMode.None;
                    Color color = scrollbarButtonColor;
                    using (SolidBrushPlus brush = new SolidBrushPlus(color, true))
                    {
                        gp.FillRoundRectangle(bounds, r, brush);
                    }
                    using (PenPlus pen = new PenPlus(ScrollBarButtonBorderColor, 1, true))
                    {
                        gp.DrawRoundRectangle(bounds, r, pen);
                    }
                }
            }

            return bm;
        }