1234567891011121314151617181920212223242526272829 |
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- namespace Optimizer
- {
- internal sealed class MoonProgress : ProgressBar
- {
- public MoonProgress()
- {
- DoubleBuffered = true;
- this.SetStyle(ControlStyles.UserPaint, true);
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- LinearGradientBrush brush = null;
- Rectangle rec = new Rectangle(0, 0, this.Width, this.Height);
- if (ProgressBarRenderer.IsSupported)
- ProgressBarRenderer.DrawHorizontalBar(e.Graphics, rec);
- rec.Width = (int)(rec.Width * ((double)base.Value / Maximum)) - 4;
- rec.Height -= 4;
- brush = new LinearGradientBrush(rec, OptionsHelper.ForegroundAccentColor, OptionsHelper.ForegroundColor, LinearGradientMode.Vertical);
- e.Graphics.FillRectangle(brush, 2, 2, rec.Width, rec.Height);
- }
- }
- }
|