Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Import
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Drawing.Text;
- using System.Windows.Forms;
- #endregion
- #region Copyright & Contact
- // Creator: Cheat Eye
- // Version: 1.0.0
- #endregion
- #region ProgressBar
- public class BlueProgressBar : Control
- {
- #region variables
- private Rectangle BGShape;
- private int _Value = 10;
- private Pen P = new Pen(Color.FromArgb(20, 60, 71));
- #endregion
- #region Properties
- [Category("Behavior")]
- public int Value
- {
- get { return _Value; }
- set
- {
- _Value = value;
- Invalidate();
- }
- }
- #endregion
- public BlueProgressBar()
- {
- Width = 300;
- Height = 13;
- Font = new Font("Roboto", 10);
- DoubleBuffered = true;
- }
- protected override void OnResize(EventArgs e)
- {
- base.OnResize(e);
- BGShape = new Rectangle(0, 0, Width - 1, Height - 1);
- Invalidate();
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- Graphics G = e.Graphics;
- HatchBrush Hatch = new HatchBrush(HatchStyle.WideUpwardDiagonal, Color.FromArgb(42, 137, 247), Color.FromArgb(42, 137, 247));
- if (_Value <= 100 && _Value >= 0)
- {
- G.DrawRectangle(P, BGShape);
- G.FillRectangle(Hatch, 2, 2, (Width * _Value) / (100 - 0) - 4, Height - 4);
- }
- else
- {
- _Value = 10;
- MessageBox.Show("Wrong value...!", "Blue Theme", MessageBoxButtons.OK, MessageBoxIcon.Information);
- G.DrawRectangle(P, BGShape);
- G.FillRectangle(Hatch, 2, 2, (Width * _Value) / (100 - 0) - 4, Height - 4);
- }
- }
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement