diff options
| author | Michael <[email protected]> | 2017-07-02 21:48:10 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-02 21:48:10 -0400 |
| commit | 6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604 (patch) | |
| tree | 9f138619a1cf4ebe7a7ece6c6a411adbe64843d6 /ShiftOS.Frontend/GUI/ProgressBar.cs | |
| parent | 5d5f351138b55b27fe92690d824257b6b6e1a469 (diff) | |
| download | shiftos_thereturn-6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604.tar.gz shiftos_thereturn-6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604.tar.bz2 shiftos_thereturn-6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604.zip | |
A day's worth of hell... which is turning into heaven.
Diffstat (limited to 'ShiftOS.Frontend/GUI/ProgressBar.cs')
| -rw-r--r-- | ShiftOS.Frontend/GUI/ProgressBar.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/ShiftOS.Frontend/GUI/ProgressBar.cs b/ShiftOS.Frontend/GUI/ProgressBar.cs new file mode 100644 index 0000000..f0dd626 --- /dev/null +++ b/ShiftOS.Frontend/GUI/ProgressBar.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static ShiftOS.Engine.SkinEngine; + +namespace ShiftOS.Frontend.GUI +{ + public class ProgressBar : Control + { + private int _maximum = 100; + private int _value = 0; + + public int Maximum + { + get + { + return _maximum; + } + set + { + _maximum = value; + } + } + + public int Value + { + get + { + return _value; + } + set + { + _value = value; + } + } + + public override void Paint(Graphics gfx) + { + gfx.Clear(LoadedSkin.ProgressBarBackgroundColor); + int w = (int)linear(_value, 0, _maximum, 0, Width); + gfx.FillRectangle(new SolidBrush(LoadedSkin.ProgressColor), new Rectangle(0, 0, w, Height)); + } + + static public double linear(double x, double x0, double x1, double y0, double y1) + { + if ((x1 - x0) == 0) + { + return (y0 + y1) / 2; + } + return y0 + (x - x0) * (y1 - y0) / (x1 - x0); + } + + } +} |
