using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PaintDotNet.Preview2 { public partial class MyProgressBar : UserControl { double _max = 100; double _min = 0; public MyProgressBar() { InitializeComponent(); panel1.BackColor = CommonDefine.Blue; } double _value; public double Value { get => _value; set { value = Math.Min(_max, Math.Max(_min, value)); _value = value; panel1.Width = (int)(this.Width / (_max - _min) * (value - _min)); } } } }