Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions MaterialSkin/Controls/MaterialProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public MaterialProgressBar()
[Browsable(false)]
public MouseState MouseState { get; set; }

public bool UseAccentColor { get; set; }

protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
{
base.SetBoundsCore(x, y, width, 5, specified);
Expand All @@ -29,10 +31,23 @@ protected override void SetBoundsCore(int x, int y, int width, int height, Bound
protected override void OnPaint(PaintEventArgs e)
{
var doneProgress = (int)(Width * ((double)Value / Maximum));
e.Graphics.FillRectangle(Enabled ?
SkinManager.ColorScheme.PrimaryBrush :
new SolidBrush(DrawHelper.BlendColor(SkinManager.ColorScheme.PrimaryColor, SkinManager.SwitchOffDisabledThumbColor, 197)),
0, 0, doneProgress, Height);
brush b = null;
if ( Enabled )
{
if ( UseAccentColor )
{
b = SkinManager.ColorScheme.AccentBrush;
}
else
{
b = SkinManager.ColorScheme.PrimaryBrush;
}
}
else
{
b = new SolidBrush( DrawHelper.BlendColor( SkinManager.ColorScheme.PrimaryColor, SkinManager.SwitchOffDisabledThumbColor, 197 ) );
}
e.Graphics.FillRectangle(b, 0, 0, doneProgress, Height);
e.Graphics.FillRectangle(SkinManager.BackgroundFocusBrush, doneProgress, 0, Width - doneProgress, Height);
}
}
Expand Down