protected override void OnPaint(PaintEventArgs e) { using (e) { ProgressBarRenderEventArgs args = new ProgressBarRenderEventArgs(e.Graphics, this); this.FRenderer.DrawBackground(args); if (base.Style == ProgressBarStyle.Marquee) { ProgressBarMarqueeRenderEventArgs args2 = new ProgressBarMarqueeRenderEventArgs(e.Graphics, this, this.MarqueeTag); this.FRenderer.DrawMarquee(args2); } else { ProgressBarValueRenderEventArgs args3 = new ProgressBarValueRenderEventArgs(e.Graphics, this); this.FRenderer.DrawBarValue(args3); } } }
public void DrawBarValue(ProgressBarValueRenderEventArgs e) { if ((e.Maximum != e.Minimum) && (e.Value != 0)) { int num = e.Bounds.Width - 7; int width = (num * e.Value) / (e.Maximum - e.Minimum); if (width != 0) { if ((e.ProgressBar.Style == ProgressBarStyle.Blocks) && ((width % this.ChunkWidth) != 0)) { int num3 = width % this.ChunkWidth; width += this.ChunkWidth - num3; if (width > num) { width = num; } } Rectangle rect = new Rectangle(e.Bounds.Left + 3, e.Bounds.Top + 2, width, e.Bounds.Bottom - 4); using (LinearGradientBrush brush = new LinearGradientBrush(rect, this.BarBackgroundColor, this.BarColor, 90f)) { brush.Blend = this.BarBlend; e.Graphics.FillRectangle(brush, rect); } if (e.ProgressBar.Style == ProgressBarStyle.Blocks) { int num4 = width / this.ChunkWidth; using (Pen pen = new Pen(this.BarBackgroundColor, 2f)) { for (int i = 0; i <= num4; i++) { e.Graphics.DrawLine(pen, (int) ((e.Bounds.Left + (this.ChunkWidth * i)) + 3), (int) (e.Bounds.Top + 2), (int) ((e.Bounds.Left + (this.ChunkWidth * i)) + 3), (int) (e.Bounds.Bottom - 2)); } } } } } }
public void DrawBarValue(ProgressBarValueRenderEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; float num = (e.Value * 1f) / ((float) (e.Maximum - e.Minimum)); this.DrawBar(e.Graphics, e.Bounds, num); this.DrawBarShadows(e.Graphics, e.Bounds, num); this.DrawBarHighlight(e.Graphics, e.Bounds); this.DrawInnerStroke(e.Graphics, e.Bounds); this.DrawOuterStroke(e.Graphics, e.Bounds); }