//***************************************************************************
        // Base-Class Override Methods
        //
        protected override void OnPaint(PaintEventArgs e)
        {
            {
                Graphics g          = e.Graphics;
                Region   origRegion = g.Clip.Clone();
                g.Clear(this.BackColor);

                // We use this GraphicsPath to define the area the progress bar can
                //   be drawn in.
                using (GraphicsPath progressArea = new GraphicsPath())
                {
                    // Prepare the clipping region for the progress bar area.
                    FeatheredRectangle rClipRegion = new FeatheredRectangle(0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, this._fthr);

                    // Set the clipping region for this graphics device to only allow
                    //   drawing in the correct area for the progress bar.
                    g.ResetClip();
                    using (Region drawArea = new Region(rClipRegion.GetRegion()))
                        g.SetClip(drawArea, CombineMode.Replace);

                    // Fill the progress bar area with the selected backrgound color.
                    g.Clear(this._bgColor);

                    // Draw the background image, if any was specified.
                    // We align the image to the control's ClientRectangle, but it
                    //   will be clipped to the feathered rectangle created in
                    //   the 'progressArea' GraphicsPath object.
                    if (this._bgImg != null)
                    {
                        using (Image bgImg = (this._bgImg.Clone() as Image))
                        {
                            bgImg.RotateFlip(this._bgImgRot);
                            switch (this._bgImgLo)
                            {
                            case ImageLayout.Center:
                                //int xPos = (this.ClientRectangle.Width / 2) - (this._bgImg.Width / 2);
                                //int yPos = (this.ClientRectangle.Height / 2) - (this._bgImg.Height / 2);
                                g.DrawImageUnscaled(bgImg, Imaging.CenterImage(bgImg, this.ClientRectangle));
                                break;

                            case ImageLayout.None:
                                g.DrawImageUnscaled(bgImg, this.ClientRectangle.Location);
                                break;

                            case ImageLayout.Stretch:
                                g.DrawImage(bgImg, this.ClientRectangle);
                                break;

                            case ImageLayout.Tile:
                                using (TextureBrush tBrush = new TextureBrush(bgImg, this._bgImgWm))
                                    g.FillRectangle(tBrush, this.ClientRectangle);
                                break;

                            case ImageLayout.Zoom:
                                g.DrawImage(bgImg, Imaging.ZoomImage(bgImg, this.ClientRectangle));
                                break;
                            }
                        }
                    }

                    // Calculate the drawing area for the progress bar.
                    float     thirdHt   = (this.ClientRectangle.Height - this._border) / 3;
                    int       startLeft = this.ClientRectangle.Left + (this._border + 3);
                    int       startTop  = this.ClientRectangle.Top + (this._border + 3);
                    int       valWidth  = ((this.ClientRectangle.Width - ((this._border + 3) * 2)) * this._val) / (this._max + this._min);
                    Rectangle bnds      = new Rectangle(new Point(startLeft, startTop), new Size(valWidth, this.ClientRectangle.Height - ((this._border + 3) * 2)));

                    // We're not going to draw the progress bar if the control is
                    //   not enabled.
                    if (this.Enabled)
                    {
                        // If we determine that the drawing bounds is greater than nothing,
                        //   draw the progress bar.
                        if (bnds.Width > 0 && bnds.Height > 0)
                        {
                            //// Reset the clipping region for the progress bars
                            //FeatheredRectangle rProgressRegion = new FeatheredRectangle(bnds.Location.X, bnds.Location.Y, this.ClientRectangle.Width - ((this._border + 3) * 2), bnds.Height, this._fthr);
                            //g.SetClip(rProgressRegion.GetRegion(), CombineMode.Replace);

                            // Calculate the Highlight and Shadow colors
                            //   for the progress bar.
                            Color hColor  = RgbColor.LightenColor(this.ForeColor, 60);
                            Color hhColor = RgbColor.LightenColor(this.ForeColor, 30);
                            Color sColor  = RgbColor.DarkenColor(this.ForeColor, 20);

                            // Create the base brush.  If the 3d effect is on, this will be
                            //   the top of the progress bar.
                            Brush pBrush = null;
                            if (this._3d)
                            {
                                pBrush = new LinearGradientBrush(new Rectangle(bnds.Location, bnds.Size), hhColor, hhColor, LinearGradientMode.Vertical);
                                ColorBlend gradBlend = new ColorBlend(8);
                                gradBlend.Colors    = new Color[] { this.ForeColor, hColor, hColor, this.ForeColor, this.ForeColor, sColor, this.ForeColor, hhColor };
                                gradBlend.Positions = new float[] { 0.0f, 0.15f, 0.25f, 0.4f, 0.7f, 0.8f, 0.90f, 1.0f };
                                (pBrush as LinearGradientBrush).InterpolationColors = gradBlend;
                            }
                            else
                            {
                                pBrush = new SolidBrush(this.ForeColor);
                            }

                            // Finally, draw the progress bar according to the
                            //   specified ProgressBarStyle.
                            switch (this.Style)
                            {
                            case ProgressBarStyle.Blocks:
                                using (Matrix gMat = new Matrix())
                                {
                                    for (int i = 1; i < bnds.Width; i = i + this._blkWidth + this._blkSpace)
                                    {
                                        int       blockWidth = (((this._val == this._max) && (i + this._blkWidth + this._blkSpace > bnds.Right)) ? System.Math.Min(bnds.Width - i, this._blkWidth) : this._blkWidth);
                                        Rectangle rBlock     = new Rectangle(new Point((i) + bnds.Left, bnds.Top), new Size(blockWidth, bnds.Height));
                                        gMat.RotateAt(this._rotBlockDeg, new PointF(rBlock.Right - (rBlock.Width / 2), rBlock.Bottom - (rBlock.Height / 2)));
                                        g.Transform = gMat;
                                        g.FillRectangle(pBrush, rBlock);

                                        if (this._pImg != null)
                                        {
                                            using (Image pImg = (this._pImg.Clone() as Image))
                                            {
                                                pImg.RotateFlip(this._bgImgRot);
                                                switch (this._pImgLo)
                                                {
                                                case ImageLayout.Center:
                                                    //int xPos = (rBlock.Width / 2) - (this._pImg.Width / 2);
                                                    //int yPos = (rBlock.Height / 2) - (this._pImg.Height / 2);
                                                    g.DrawImageUnscaled(pImg, Imaging.CenterImage(pImg, rBlock));
                                                    break;

                                                case ImageLayout.None:
                                                    g.DrawImageUnscaled(pImg, rBlock.Location);
                                                    break;

                                                case ImageLayout.Stretch:
                                                    g.DrawImage(pImg, rBlock);
                                                    break;

                                                case ImageLayout.Tile:
                                                    using (TextureBrush tBrush = new TextureBrush(pImg, this._pImgWm))
                                                        g.FillRectangle(tBrush, rBlock);
                                                    break;

                                                case ImageLayout.Zoom:
                                                    g.DrawImage(pImg, Imaging.ZoomImage(pImg, rBlock));
                                                    break;
                                                }
                                            }
                                        }
                                        rBlock = Rectangle.Empty;
                                        gMat.Reset();
                                        g.Transform = gMat;
                                    }
                                }
                                break;

                            case ProgressBarStyle.Continuous:
                                g.FillRectangle(pBrush, bnds);

                                if (this._pImg != null)
                                {
                                    using (Image pImg = (this._pImg.Clone() as Image))
                                    {
                                        pImg.RotateFlip(this._pImgRot);
                                        switch (this._pImgLo)
                                        {
                                        case ImageLayout.Center:
                                            //int xPos = (bnds.Width / 2) - (this._pImg.Width / 2);
                                            //int yPos = (bnds.Height / 2) - (this._pImg.Height / 2);
                                            g.DrawImageUnscaled(pImg, Imaging.CenterImage(pImg, bnds));
                                            break;

                                        case ImageLayout.None:
                                            //g.DrawImageUnscaled(pImg, bnds.Location);
                                            // If there's no scaling going on, then the image should be
                                            //   drawn where the progress bar is.
                                            g.DrawImageUnscaled(pImg, new Point(bnds.Left + valWidth, bnds.Top + (bnds.Height / 2 - pImg.Height / 2)));
                                            break;

                                        case ImageLayout.Stretch:
                                            g.DrawImage(pImg, bnds);
                                            break;

                                        case ImageLayout.Tile:
                                            using (TextureBrush tBrush = new TextureBrush(pImg, this._pImgWm))
                                                g.FillRectangle(tBrush, bnds);
                                            break;

                                        case ImageLayout.Zoom:
                                            g.DrawImage(pImg, Imaging.ZoomImage(pImg, bnds));
                                            break;
                                        }
                                    }
                                }
                                break;

                            case ProgressBarStyle.Marquee:
                                break;
                            }
                            sColor = Color.Empty;
                            hColor = Color.Empty;
                            pBrush.Dispose();
                        }
                    }

                    // Draw any text on the progress bar.
                    if (!string.IsNullOrEmpty(this.Text))
                    {
                        using (StringFormat format = new StringFormat())
                        {
                            // Vertical alignment.
                            if (this._txtAlign == ContentAlignment.BottomCenter || this._txtAlign == ContentAlignment.BottomLeft || this._txtAlign == ContentAlignment.BottomRight)
                            {
                                format.LineAlignment = StringAlignment.Far;
                            }
                            else if (this._txtAlign == ContentAlignment.TopCenter || this._txtAlign == ContentAlignment.TopLeft || this._txtAlign == ContentAlignment.TopRight)
                            {
                                format.LineAlignment = StringAlignment.Near;
                            }
                            else
                            {
                                format.LineAlignment = StringAlignment.Center;
                            }

                            // Horizontal alignment.
                            if (this._txtAlign == ContentAlignment.BottomLeft || this._txtAlign == ContentAlignment.MiddleLeft || this._txtAlign == ContentAlignment.TopLeft)
                            {
                                format.LineAlignment = StringAlignment.Near;
                            }
                            else if (this._txtAlign == ContentAlignment.BottomRight || this._txtAlign == ContentAlignment.MiddleRight || this._txtAlign == ContentAlignment.TopRight)
                            {
                                format.LineAlignment = StringAlignment.Far;
                            }
                            else
                            {
                                format.LineAlignment = StringAlignment.Center;
                            }

                            // Draw the text align either to the entire control, or
                            //   only the progress bar.

                            string txtVal = this.Text.Replace(@"\v", this.Value.ToString()).Replace(@"\m", this._max.ToString()).Replace(@"\p", Convert.ToString(System.Math.Round((double)(this._val * 100) / this._max)));
                            using (SolidBrush brush = new SolidBrush(this._txtColor))
                                if (this._txtAlignCtrl)
                                {
                                    g.DrawString(txtVal, this.Font, brush, new RectangleF(startLeft, startTop, this.ClientRectangle.Width - ((this._border + 3) * 2), this.ClientRectangle.Height - ((this._border + 3) * 2)), format);
                                }
                                else
                                if (g.MeasureString(txtVal, this.Font).Width > bnds.Width)
                                {
                                    g.DrawString(txtVal, this.Font, brush, (float)bnds.X, ((bnds.Height / 2) - (g.MeasureString(txtVal, this.Font).Height / 2)) + bnds.Y);
                                }
                                else
                                {
                                    g.DrawString(txtVal, this.Font, brush, RectangleF.FromLTRB(bnds.Left, bnds.Top, bnds.Right, bnds.Bottom), format);
                                }
                        }
                    }

                    if (this._mSamp)
                    {
                        g.SmoothingMode      = SmoothingMode.AntiAlias;
                        g.CompositingMode    = CompositingMode.SourceOver;
                        g.CompositingQuality = CompositingQuality.HighQuality;
                        g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                    }

                    // Draw the borders.
                    using (Pen borderPen = new Pen(this.BorderColor, (float)this._border))
                    {
                        if (this._3d)
                        {
                            // Draw the top-left edge's inner drop shadow.
                            using (GraphicsPath shadowPath = (rClipRegion.GetBorder().Clone() as GraphicsPath))
                            {
                                shadowPath.Transform(new Matrix(rClipRegion.GetBounds(), new PointF[] { new PointF(1, 1), new PointF(rClipRegion.GetBounds().Width + 1, 1), new PointF(1, rClipRegion.GetBounds().Height + 1) }));
                                using (Pen sPen = new Pen(Color.FromArgb(120, Color.Black), 1.5f))
                                    g.DrawPath(sPen, shadowPath);
                                shadowPath.Transform(new Matrix(rClipRegion.GetBounds(), new PointF[] { new PointF(1, 1), new PointF(rClipRegion.GetBounds().Width + 1, 1), new PointF(1, rClipRegion.GetBounds().Height + 1) }));
                                using (Pen sPen = new Pen(Color.FromArgb(40, Color.Black), 2.0f))
                                    g.DrawPath(sPen, shadowPath);
                            }
                        }

                        // Reset the clipping region before drawing the outter
                        //   border lines.
                        g.ResetClip();
                        g.SetClip(origRegion, CombineMode.Replace);

                        // Draw the border lines.
                        g.DrawPath(borderPen, rClipRegion.GetBorder());
                        //}
                    }
                    bnds = Rectangle.Empty;
                }
            }
        }