/// <summary>
 /// Animations the manager on animation progress.
 /// </summary>
 /// <param name="sender">The sender.</param>
 void AnimationManager_OnAnimationProgress(object sender)
 {
     if (AnimationManagerEnd.GetProgress() >= 0.4 && !AnimationManagerStart.IsAnimating())
     {
         AnimationManagerStart.StartNewAnimation(Animations.AnimationDirection.In);
     }
     Invalidate();
 }
        /// <summary>
        /// Animations the manager on animation finished.
        /// </summary>
        /// <param name="sender">The sender.</param>
        void AnimationManager_OnAnimationFinished(object sender)
        {
            Invalidate();
            if (AnimationManagerStart.Increment == 0.02)
            {
                AnimationManagerStart.Increment = 0.025;
                AnimationManagerEnd.Increment   = 0.025;
            }
            else
            {
                AnimationManagerStart.Increment = 0.02;
                AnimationManagerEnd.Increment   = 0.02;
            }

            AnimationManagerStart.SetProgress(0);
            AnimationManagerEnd.SetProgress(0);
            AnimationManagerEnd.StartNewAnimation(Animations.AnimationDirection.In);
        }
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (_Style == ProgressStyle.Determinate)
            {
                if (Orientation == System.Windows.Forms.Orientation.Horizontal)
                {
                    var doneProgress = (int)(e.ClipRectangle.Width * ((double)Value / (Maximum - Minimum)));
                    if (InvertedProgressBar)
                    {
                        doneProgress = Width - doneProgress;
                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, 0, doneProgress, e.ClipRectangle.Height);
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, doneProgress, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, 0, 0, doneProgress, e.ClipRectangle.Height);
                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), doneProgress, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
                    }
                }
                else
                {
                    var doneProgress = (int)(e.ClipRectangle.Height * ((double)Value / Maximum));
                    if (InvertedProgressBar)
                    {
                        doneProgress = Height - doneProgress;

                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, 0, e.ClipRectangle.Width, doneProgress);
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, 0, doneProgress, e.ClipRectangle.Height, e.ClipRectangle.Height);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, 0, 0, e.ClipRectangle.Height, doneProgress);
                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, doneProgress, e.ClipRectangle.Width, e.ClipRectangle.Height);
                    }
                }
            }
            else
            {
                double startProgress = AnimationManagerStart.GetProgress();
                double EndProgress   = AnimationManagerEnd.GetProgress();
                if (Orientation == System.Windows.Forms.Orientation.Horizontal)
                {
                    var doneLocation  = (int)(e.ClipRectangle.Width * EndProgress);
                    var StartLocation = (int)(e.ClipRectangle.Width * startProgress);

                    if (InvertedProgressBar)
                    {
                        doneLocation  = Width - doneLocation;
                        StartLocation = Width - StartLocation;
                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, doneLocation, 0, StartLocation - doneLocation, e.ClipRectangle.Height);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, StartLocation, 0, doneLocation - StartLocation, e.ClipRectangle.Height);
                    }
                }
                else
                {
                    var doneLocation  = (int)(e.ClipRectangle.Height * EndProgress);
                    var StartLocation = (int)(e.ClipRectangle.Height * startProgress);

                    if (InvertedProgressBar)
                    {
                        doneLocation  = Height - doneLocation;
                        StartLocation = Height - StartLocation;

                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, 0, doneLocation, e.ClipRectangle.Height, StartLocation - doneLocation);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(SkinManager.GetDisabledOrHintBrush(), 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
                        e.Graphics.FillRectangle(SkinManager.ColorScheme.PrimaryBrush, 0, StartLocation, e.ClipRectangle.Width, doneLocation - StartLocation);
                    }
                }
            }
        }