From 05d66a57b85d6f0bfb82fba2f672dc9c9252b9af Mon Sep 17 00:00:00 2001 From: LadyDefile <67084868+LadyDefile@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:39:25 -0600 Subject: [PATCH] Update MaterialProgressBar.cs By adding the `UseAccentColor` property it allows the user to have more options when designing the user interface --- MaterialSkin/Controls/MaterialProgressBar.cs | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/MaterialSkin/Controls/MaterialProgressBar.cs b/MaterialSkin/Controls/MaterialProgressBar.cs index aeb913bc..1c0f7637 100644 --- a/MaterialSkin/Controls/MaterialProgressBar.cs +++ b/MaterialSkin/Controls/MaterialProgressBar.cs @@ -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); @@ -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); } }