mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-14 17:42:47 +01:00
34 lines
908 B
C#
34 lines
908 B
C#
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TweetDuck.Video{
|
|
sealed class FlatProgressBar : ProgressBar{
|
|
private readonly SolidBrush brush;
|
|
|
|
public FlatProgressBar(){
|
|
brush = new SolidBrush(Color.White);
|
|
|
|
SetStyle(ControlStyles.UserPaint, true);
|
|
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
|
}
|
|
|
|
protected override void OnPaint(PaintEventArgs e){
|
|
if (brush.Color != ForeColor){
|
|
brush.Color = ForeColor;
|
|
}
|
|
|
|
Rectangle rect = e.ClipRectangle;
|
|
rect.Width = (int)(rect.Width*((double)Value/Maximum));
|
|
e.Graphics.FillRectangle(brush, rect);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing){
|
|
base.Dispose(disposing);
|
|
|
|
if (disposing){
|
|
brush.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|