namespace VaioxOnline
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Drawing.Text;
    using System.Windows.Forms;

    internal class FlatGroupBox : ContainerControl
    {
        private Color _BaseColor = Color.FromArgb(60, 70, 0x49);
        private bool _ShowText = true;
        private int H;
        private int W;

        public FlatGroupBox()
        {
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
            this.DoubleBuffered = true;
            this.BackColor = Color.Transparent;
            base.Size = new Size(240, 180);
            this.Font = new Font("Segoe ui", 10f);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            Helpers.B = new Bitmap(base.Width, base.Height);
            Helpers.G = Graphics.FromImage(Helpers.B);
            this.W = base.Width - 1;
            this.H = base.Height - 1;
            GraphicsPath path = new GraphicsPath();
            GraphicsPath path2 = new GraphicsPath();
            GraphicsPath path3 = new GraphicsPath();
            Rectangle rectangle = new Rectangle(8, 8, this.W - 0x10, this.H - 0x10);
            Graphics g = Helpers.G;
            g.SmoothingMode = SmoothingMode.HighQuality;
            g.PixelOffsetMode = PixelOffsetMode.HighQuality;
            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            g.Clear(this.BackColor);
            path = Helpers.RoundRec(rectangle, 8);
            g.FillPath(new SolidBrush(this._BaseColor), path);
            path2 = Helpers.DrawArrow(0x1c, 2, false);
            g.FillPath(new SolidBrush(this._BaseColor), path2);
            path3 = Helpers.DrawArrow(0x1c, 8, true);
            g.FillPath(new SolidBrush(Color.FromArgb(60, 70, 0x49)), path3);
            if (this.ShowText)
            {
                g.DrawString(this.Text, this.Font, new SolidBrush(Helpers._FlatColor), new Rectangle(0x10, 0x10, this.W, this.H), Helpers.NearSF);
            }
            g = null;
            base.OnPaint(e);
            Helpers.G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(Helpers.B, 0, 0);
            Helpers.B.Dispose();
        }

        [Category("Colors")]
        public Color BaseColor
        {
            get => 
                this._BaseColor
            set
            {
                this._BaseColor = value;
            }
        }

        public bool ShowText
        {
            get => 
                this._ShowText
            set
            {
                this._ShowText = value;
            }
        }
    }
}

