protected override void OnPaint(PaintEventArgs e)
        {
            //UpdateColors();

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            W = Width - 1;
            H = Height - 1;

            GraphicsPath GP   = new GraphicsPath();
            GraphicsPath GP2  = new GraphicsPath();
            GraphicsPath GP3  = new GraphicsPath();
            Rectangle    Base = new Rectangle(8, 8, W - 16, H - 16);

            var _with7 = G;

            _with7.SmoothingMode     = SmoothingMode.HighQuality;
            _with7.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            _with7.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            _with7.Clear(BackColor);

            //-- Base
            GP = ForeverLibrary.RoundRec(Base, 8);
            _with7.FillPath(new SolidBrush(_BaseColor), GP);

            //-- Arrows
            if (_ShowArrow)
            {
                GP2 = ForeverLibrary.DrawArrow(28, 2, false);
                _with7.FillPath(new SolidBrush(_ArrowColorH), GP2);
                GP3 = ForeverLibrary.DrawArrow(28, 8, true);
                _with7.FillPath(new SolidBrush(_ArrowColorF), GP3);
            }

            //-- if ShowText
            if (ShowText)
            {
                _with7.DrawString(Text, Font, new SolidBrush(_TextColor), new Rectangle(16, 16, W, H), ForeverLibrary.NearSF);
            }

            base.OnPaint(e);
            G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(B, 0, 0);
            B.Dispose();
        }
        private void UpdateColors()
        {
            ForeverColors Colors = ForeverLibrary.GetColors(this);

            _ProgressColor = Colors.Forever;
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            //UpdateColors();

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            W = Width - 1;
            H = Height - 1;

            Rectangle    Base = new Rectangle(0, 24, W, H);
            GraphicsPath GP   = new GraphicsPath();
            GraphicsPath GP2  = new GraphicsPath();
            GraphicsPath GP3  = new GraphicsPath();

            var _with15 = G;

            _with15.SmoothingMode     = SmoothingMode.HighQuality;
            _with15.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            _with15.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            _with15.Clear(BackColor);

            //-- Progress Value
            //int iValue = Convert.ToInt32(((float)_Value) / ((float)(_Maximum * Width)));
            float percent = ((float)_Value) / ((float)_Maximum);
            int   iValue  = (int)(percent * ((float)Width));

            switch (Value)
            {
            case 0:
                //-- Base
                _with15.FillRectangle(new SolidBrush(_BaseColor), Base);
                //--Progress
                _with15.FillRectangle(new SolidBrush(_ProgressColor), new Rectangle(0, 24, iValue - 1, H - 1));
                break;

            case 100:
                //-- Base
                _with15.FillRectangle(new SolidBrush(_BaseColor), Base);
                //--Progress
                _with15.FillRectangle(new SolidBrush(_ProgressColor), new Rectangle(0, 24, iValue - 1, H - 1));
                break;

            default:
                //-- Base
                _with15.FillRectangle(new SolidBrush(_BaseColor), Base);

                //--Progress
                GP.AddRectangle(new Rectangle(0, 24, iValue - 1, H - 1));
                _with15.FillPath(new SolidBrush(_ProgressColor), GP);

                if (_Pattern)
                {
                    //-- Hatch Brush
                    HatchBrush HB = new HatchBrush(HatchStyle.Plaid, _DarkerProgress, _ProgressColor);
                    _with15.FillRectangle(HB, new Rectangle(0, 24, iValue - 1, H - 1));
                }

                if (_ShowBalloon)
                {
                    //-- Balloon
                    Rectangle Balloon = new Rectangle(iValue - 18, 0, 34, 16);
                    GP2 = ForeverLibrary.RoundRec(Balloon, 4);
                    _with15.FillPath(new SolidBrush(_BaseColor), GP2);

                    //-- Arrow
                    GP3 = ForeverLibrary.DrawArrow(iValue - 9, 16, true);
                    _with15.FillPath(new SolidBrush(_BaseColor), GP3);

                    //-- Value > You can add "%" > value & "%"
                    string text    = (_PercentSign ? Value.ToString() + "%" : Value.ToString());
                    int    wOffset = (_PercentSign ? iValue - 15 : iValue - 11);
                    _with15.DrawString(text, new Font("Segoe UI", 10), new SolidBrush(ForeColor), new Rectangle(wOffset, -2, W, H), ForeverLibrary.NearSF);
                }

                break;
            }

            base.OnPaint(e);
            G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(B, 0, 0);
            B.Dispose();
        }
Exemple #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            //UpdateColors();

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            W = Width - 1;
            H = Height - 1;

            GraphicsPath GP   = new GraphicsPath();
            Rectangle    Base = new Rectangle(0, 0, W, H);

            var _with8 = G;

            _with8.SmoothingMode     = SmoothingMode.HighQuality;
            _with8.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            _with8.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            _with8.Clear(BackColor);

            switch (State)
            {
            case MouseStateForever.None:
                if (Rounded)
                {
                    //-- Base
                    GP = ForeverLibrary.RoundRec(Base, 6);
                    _with8.FillPath(new SolidBrush(_BaseColor), GP);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                else
                {
                    //-- Base
                    _with8.FillRectangle(new SolidBrush(_BaseColor), Base);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                break;

            case MouseStateForever.Over:
                if (Rounded)
                {
                    //-- Base
                    GP = ForeverLibrary.RoundRec(Base, 6);
                    _with8.FillPath(new SolidBrush(_BaseColor), GP);
                    _with8.FillPath(new SolidBrush(Color.FromArgb(20, Color.White)), GP);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                else
                {
                    //-- Base
                    _with8.FillRectangle(new SolidBrush(_BaseColor), Base);
                    _with8.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), Base);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                break;

            case MouseStateForever.Down:
                if (Rounded)
                {
                    //-- Base
                    GP = ForeverLibrary.RoundRec(Base, 6);
                    _with8.FillPath(new SolidBrush(_BaseColor), GP);
                    _with8.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), GP);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                else
                {
                    //-- Base
                    _with8.FillRectangle(new SolidBrush(_BaseColor), Base);
                    _with8.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.Black)), Base);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                break;
            }

            base.OnPaint(e);
            G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(B, 0, 0);
            B.Dispose();
        }
Exemple #5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            //UpdateColors();

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            W = Width - 1;
            H = Height - 1;

            GraphicsPath GP     = new GraphicsPath();
            GraphicsPath GP2    = new GraphicsPath();
            Rectangle    Base   = new Rectangle(0, 0, W, H);
            Rectangle    Toggle = new Rectangle(Convert.ToInt32(W / 2), 0, 38, H);

            var _with9 = G;

            _with9.SmoothingMode     = SmoothingMode.HighQuality;
            _with9.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            _with9.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            _with9.Clear(BackColor);

            switch (O)
            {
            case _Options.Style1:
                //-- Style 1
                //-- Base
                GP  = ForeverLibrary.RoundRec(Base, 6);
                GP2 = ForeverLibrary.RoundRec(Toggle, 6);
                _with9.FillPath(new SolidBrush(_BGColor), GP);
                _with9.FillPath(new SolidBrush(_ToggleColor), GP2);

                //-- Text
                _with9.DrawString("OFF", Font, new SolidBrush(_BGColor), new Rectangle(19, 1, W, H), ForeverLibrary.CenterSF);

                if (Checked)
                {
                    //-- Base
                    GP  = ForeverLibrary.RoundRec(Base, 6);
                    GP2 = ForeverLibrary.RoundRec(new Rectangle(Convert.ToInt32(W / 2), 0, 38, H), 6);
                    _with9.FillPath(new SolidBrush(_ToggleColor), GP);
                    _with9.FillPath(new SolidBrush(_BaseColor), GP2);

                    //-- Text
                    _with9.DrawString("ON", Font, new SolidBrush(_BaseColor), new Rectangle(8, 7, W, H), ForeverLibrary.NearSF);
                }
                break;

            case _Options.Style2:
                //-- Style 2
                //-- Base
                GP     = ForeverLibrary.RoundRec(Base, 6);
                Toggle = new Rectangle(4, 4, 36, H - 8);
                GP2    = ForeverLibrary.RoundRec(Toggle, 4);
                _with9.FillPath(new SolidBrush(_BaseColorRed), GP);
                _with9.FillPath(new SolidBrush(_ToggleColor), GP2);

                //-- Lines
                _with9.DrawLine(new Pen(_BGColor), 18, 20, 18, 12);
                _with9.DrawLine(new Pen(_BGColor), 22, 20, 22, 12);
                _with9.DrawLine(new Pen(_BGColor), 26, 20, 26, 12);

                //-- Text
                _with9.DrawString("r", new Font("Marlett", 8), new SolidBrush(_TextColor), new Rectangle(19, 2, Width, Height), ForeverLibrary.CenterSF);

                if (Checked)
                {
                    GP     = ForeverLibrary.RoundRec(Base, 6);
                    Toggle = new Rectangle(Convert.ToInt32(W / 2) - 2, 4, 36, H - 8);
                    GP2    = ForeverLibrary.RoundRec(Toggle, 4);
                    _with9.FillPath(new SolidBrush(_BaseColor), GP);
                    _with9.FillPath(new SolidBrush(_ToggleColor), GP2);

                    //-- Lines
                    _with9.DrawLine(new Pen(_BGColor), Convert.ToInt32(W / 2) + 12, 20, Convert.ToInt32(W / 2) + 12, 12);
                    _with9.DrawLine(new Pen(_BGColor), Convert.ToInt32(W / 2) + 16, 20, Convert.ToInt32(W / 2) + 16, 12);
                    _with9.DrawLine(new Pen(_BGColor), Convert.ToInt32(W / 2) + 20, 20, Convert.ToInt32(W / 2) + 20, 12);

                    //-- Text
                    _with9.DrawString("ü", new Font("Wingdings", 14), new SolidBrush(_TextColor), new Rectangle(8, 7, Width, Height), ForeverLibrary.NearSF);
                }
                break;

            case _Options.Style3:
                //-- Style 3
                //-- Base
                GP     = ForeverLibrary.RoundRec(Base, 16);
                Toggle = new Rectangle(W - 28, 4, 22, H - 8);
                GP2.AddEllipse(Toggle);
                _with9.FillPath(new SolidBrush(_ToggleColor), GP);
                _with9.FillPath(new SolidBrush(_BaseColorRed), GP2);

                //-- Text
                _with9.DrawString("OFF", Font, new SolidBrush(_BaseColorRed), new Rectangle(-12, 2, W, H), ForeverLibrary.CenterSF);

                if (Checked)
                {
                    //-- Base
                    GP     = ForeverLibrary.RoundRec(Base, 16);
                    Toggle = new Rectangle(6, 4, 22, H - 8);
                    GP2.Reset();
                    GP2.AddEllipse(Toggle);
                    _with9.FillPath(new SolidBrush(_ToggleColor), GP);
                    _with9.FillPath(new SolidBrush(_BaseColor), GP2);

                    //-- Text
                    _with9.DrawString("ON", Font, new SolidBrush(_BaseColor), new Rectangle(12, 2, W, H), ForeverLibrary.CenterSF);
                }
                break;
            }

            base.OnPaint(e);
            G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(B, 0, 0);
            B.Dispose();
        }
Exemple #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            //UpdateColors();

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            W = Width;
            H = Height;

            GraphicsPath GP = new GraphicsPath();

            bool[] GCS = GetConnectedSides();
            // dynamic RoundedBase = ForeverLibrary.RoundRect(0, 0, W, H, ???, !(GCS(2) | GCS(1)), !(GCS(1) | GCS(0)), !(GCS(3) | GCS(0)), !(GCS(3) | GCS(2)));
            GraphicsPath RoundedBase = ForeverLibrary.RoundRect(0, 0, W, H, 0.3, !(GCS[2] || GCS[1]), !(GCS[1] || GCS[0]), !(GCS[3] || GCS[0]), !(GCS[3] || GCS[2]));
            Rectangle    Base        = new Rectangle(0, 0, W, H);

            var _with17 = G;

            _with17.SmoothingMode     = SmoothingMode.HighQuality;
            _with17.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            _with17.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            _with17.Clear(BackColor);

            switch (State)
            {
            case MouseStateForever.None:
                if (Rounded)
                {
                    //-- Base
                    GP = RoundedBase;
                    _with17.FillPath(new SolidBrush(_BaseColor), GP);

                    //-- Text
                    _with17.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                else
                {
                    //-- Base
                    _with17.FillRectangle(new SolidBrush(_BaseColor), Base);

                    //-- Text
                    _with17.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                break;

            case MouseStateForever.Over:
                if (Rounded)
                {
                    //-- Base
                    GP = RoundedBase;
                    _with17.FillPath(new SolidBrush(_BaseColor), GP);
                    _with17.FillPath(new SolidBrush(Color.FromArgb(20, Color.White)), GP);

                    //-- Text
                    _with17.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                else
                {
                    //-- Base
                    _with17.FillRectangle(new SolidBrush(_BaseColor), Base);
                    _with17.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), Base);

                    //-- Text
                    _with17.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                break;

            case MouseStateForever.Down:
                if (Rounded)
                {
                    //-- Base
                    GP = RoundedBase;
                    _with17.FillPath(new SolidBrush(_BaseColor), GP);
                    _with17.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), GP);

                    //-- Text
                    _with17.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                else
                {
                    //-- Base
                    _with17.FillRectangle(new SolidBrush(_BaseColor), Base);
                    _with17.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.Black)), Base);

                    //-- Text
                    _with17.DrawString(Text, Font, new SolidBrush(_TextColor), Base, ForeverLibrary.CenterSF);
                }
                break;
            }

            base.OnPaint(e);
            G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(B, 0, 0);
            B.Dispose();
        }
        private void UpdateColors()
        {
            ForeverColors Colors = ForeverLibrary.GetColors(this);

            _ButtonColorA = Colors.Forever;
        }
        private void UpdateColors()
        {
            ForeverColors Colors = ForeverLibrary.GetColors(this);

            _SelectedColor = Colors.Forever;
        }