CapDemo.ProgressBarControl.OnPaint C# (CSharp) Метод

OnPaint() защищенный Метод

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
Результат void
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            //dòng này nếu muốn có số chạy giữa thanh progressBar
            //label1.Location = new Point((this.Width / 2) - (label1.Width / 2), (this.Height / 2) - (label1.Height / 2));

            LinearGradientBrush lgb = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), Color.White, this.ForeColor, LinearGradientMode.ForwardDiagonal);

            int Width = (int)((percent / max) * this.Width);

            e.Graphics.FillRectangle(lgb, 0, 0, Width, this.Height);

            lgb.Dispose();
        }