protected override void OnPaint(PaintEventArgs e) { this.UpdateColors(); Bitmap bitmap = new Bitmap(this.Width, this.Height); Graphics graphics1 = Graphics.FromImage((Image)bitmap); this.W = this.Width - 1; this.H = this.Height - 1; Rectangle rect = new Rectangle(0, 24, this.W, this.H); GraphicsPath path1 = new GraphicsPath(); GraphicsPath graphicsPath1 = new GraphicsPath(); GraphicsPath graphicsPath2 = new GraphicsPath(); Graphics graphics2 = graphics1; graphics2.SmoothingMode = SmoothingMode.HighQuality; graphics2.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics2.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; graphics2.Clear(this.BackColor); int num = (int)((double)((float)this._Value / (float)this._Maximum) * (double)this.Width); switch (this.Value) { case 0: graphics2.FillRectangle((Brush) new SolidBrush(this._BaseColor), rect); graphics2.FillRectangle((Brush) new SolidBrush(this._ProgressColor), new Rectangle(0, 24, num - 1, this.H - 1)); break; case 100: graphics2.FillRectangle((Brush) new SolidBrush(this._BaseColor), rect); graphics2.FillRectangle((Brush) new SolidBrush(this._ProgressColor), new Rectangle(0, 24, num - 1, this.H - 1)); break; default: graphics2.FillRectangle((Brush) new SolidBrush(this._BaseColor), rect); path1.AddRectangle(new Rectangle(0, 24, num - 1, this.H - 1)); graphics2.FillPath((Brush) new SolidBrush(this._ProgressColor), path1); if (this._Pattern) { HatchBrush hatchBrush = new HatchBrush(HatchStyle.Plaid, this._DarkerProgress, this._ProgressColor); graphics2.FillRectangle((Brush)hatchBrush, new Rectangle(0, 24, num - 1, this.H - 1)); } if (this._ShowBalloon) { GraphicsPath path2 = Helpers.RoundRec(new Rectangle(num - 18, 0, 34, 16), 4); graphics2.FillPath((Brush) new SolidBrush(this._BaseColor), path2); GraphicsPath path3 = Helpers.DrawArrow(num - 9, 16, true); graphics2.FillPath((Brush) new SolidBrush(this._BaseColor), path3); string s = this._PercentSign ? this.Value.ToString() + "%" : this.Value.ToString(); int x = this._PercentSign ? num - 15 : num - 11; graphics2.DrawString(s, new Font("Segoe UI", 10f), (Brush) new SolidBrush(this._ProgressColor), (RectangleF) new Rectangle(x, -2, this.W, this.H), Helpers.NearSF); break; } break; } base.OnPaint(e); graphics1.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled((Image)bitmap, 0, 0); bitmap.Dispose(); }
protected override void OnPaint(PaintEventArgs e) { UpdateColors(); var B = new Bitmap(Width, Height); var G = Graphics.FromImage(B); W = Width - 1; H = Height - 1; var GP = new GraphicsPath(); var GP2 = new GraphicsPath(); var GP3 = new GraphicsPath(); var 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 = Helpers.RoundRec(Base, 8); _with7.FillPath(new SolidBrush(BaseColor), GP); //-- Arrows GP2 = Helpers.DrawArrow(28, 2, false); _with7.FillPath(new SolidBrush(BaseColor), GP2); GP3 = Helpers.DrawArrow(28, 8, true); _with7.FillPath(new SolidBrush(Color.FromArgb(35, 30, 59)), GP3); //-- if ShowText if (ShowText) { _with7.DrawString(Text, Font, new SolidBrush(_TextColor), new Rectangle(16, 16, W, H), Helpers.NearSF); } base.OnPaint(e); G.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled(B, 0, 0); B.Dispose(); }
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 = Helpers.RoundRec(Base, 8); with7.FillPath(new SolidBrush(_baseColor), gp); //-- Arrows gp2 = Helpers.DrawArrow(28, 2, false); with7.FillPath(new SolidBrush(_baseColor), gp2); gp3 = Helpers.DrawArrow(28, 8, true); with7.FillPath(new SolidBrush(Color.FromArgb(60, 70, 73)), gp3); //-- if ShowText if (ShowText) { with7.DrawString(Text, Font, new SolidBrush(_textColor), new Rectangle(16, 16, _w, _h), Helpers.NearSf); } base.OnPaint(e); g.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled(b, 0, 0); b.Dispose(); }
protected override void OnPaint(PaintEventArgs e) { this.UpdateColors(); Bitmap bitmap = new Bitmap(this.Width, this.Height); Graphics graphics1 = Graphics.FromImage((Image)bitmap); this.W = this.Width - 1; this.H = this.Height - 1; GraphicsPath graphicsPath1 = new GraphicsPath(); GraphicsPath graphicsPath2 = new GraphicsPath(); GraphicsPath graphicsPath3 = new GraphicsPath(); Rectangle Rectangle = new Rectangle(8, 8, this.W - 16, this.H - 16); Graphics graphics2 = graphics1; graphics2.SmoothingMode = SmoothingMode.HighQuality; graphics2.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics2.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; graphics2.Clear(this.BackColor); GraphicsPath path1 = Helpers.RoundRec(Rectangle, 8); graphics2.FillPath((Brush) new SolidBrush(this._BaseColor), path1); GraphicsPath path2 = Helpers.DrawArrow(28, 2, false); graphics2.FillPath((Brush) new SolidBrush(this._BaseColor), path2); GraphicsPath path3 = Helpers.DrawArrow(28, 8, true); graphics2.FillPath((Brush) new SolidBrush(Color.FromArgb(60, 70, 73)), path3); if (this.ShowText) { graphics2.DrawString(this.Text, this.Font, (Brush) new SolidBrush(this._TextColor), (RectangleF) new Rectangle(16, 16, this.W, this.H), Helpers.NearSF); } base.OnPaint(e); graphics1.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled((Image)bitmap, 0, 0); bitmap.Dispose(); }
protected override void OnPaint(PaintEventArgs e) { this.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 = Helpers.RoundRec(Balloon, 4); _with15.FillPath(new SolidBrush(_BaseColor), GP2); //-- Arrow GP3 = Helpers.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(_ProgressColor), new Rectangle(wOffset, -2, W, H), Helpers.NearSF); } break; } base.OnPaint(e); G.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled(B, 0, 0); B.Dispose(); }
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 = Helpers.RoundRec(balloon, 4); with15.FillPath(new SolidBrush(_baseColor), gp2); //-- Arrow gp3 = Helpers.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(_progressColor), new Rectangle(wOffset, -2, _w, _h), Helpers.NearSf); } break; } base.OnPaint(e); g.Dispose(); e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.DrawImageUnscaled(b, 0, 0); b.Dispose(); }