aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Controls
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-16 15:45:00 -0400
committerMichael <[email protected]>2017-05-16 15:45:00 -0400
commit20d44ba1334b5af65605de27a01e8dcb40fa2081 (patch)
tree6e190de73ba8ac8386784696609ecc1dc180cacb /ShiftOS.WinForms/Controls
parent7919afa133561da65304f01498db5993510702e8 (diff)
downloadshiftos_thereturn-20d44ba1334b5af65605de27a01e8dcb40fa2081.tar.gz
shiftos_thereturn-20d44ba1334b5af65605de27a01e8dcb40fa2081.tar.bz2
shiftos_thereturn-20d44ba1334b5af65605de27a01e8dcb40fa2081.zip
i <3 rylan wait wrong textbox whatever
Diffstat (limited to 'ShiftOS.WinForms/Controls')
-rw-r--r--ShiftOS.WinForms/Controls/ShiftedProgressBar.cs37
1 files changed, 33 insertions, 4 deletions
diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs
index ceaff02..3c8550c 100644
--- a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs
+++ b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs
@@ -27,6 +27,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -138,12 +139,40 @@ namespace ShiftOS.WinForms.Controls
}
}
+ public TextureBrush CreateBG()
+ {
+ var tex = new TextureBrush(RealBackgroundImage);
+ var mt = new Matrix(new Rectangle(0, 0, this.Width, this.Height), new[]
+ {
+ new Point(0,0),
+ new Point(this.Width,0),
+ new Point(this.Width, this.Height)
+ });
+ tex.Transform = mt;
+ tex.WrapMode = WrapMode.Clamp;
+ return tex;
+ }
+
+ public TextureBrush CreateTexture()
+ {
+ var tex = new TextureBrush(ProgressImage);
+ var mt = new Matrix(new Rectangle(0, 0, this.Width, this.Height), new[]
+ {
+ new Point(0,0),
+ new Point(this.Width,0),
+ new Point(this.Width, this.Height)
+ });
+ tex.Transform = mt;
+ tex.WrapMode = WrapMode.Clamp;
+ return tex;
+ }
+
protected override void OnPaint(PaintEventArgs pe)
{
pe.Graphics.Clear(this.RealBackColor);
if(RealBackgroundImage != null)
{
- pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height));
+ pe.Graphics.FillRectangle(CreateBG(), new Rectangle(0, 0, this.Width, this.Height));
}
switch (Style)
{
@@ -151,7 +180,7 @@ namespace ShiftOS.WinForms.Controls
double width = linear(this.Value, 0, this.Maximum, 0, this.Width);
if (ProgressImage != null)
{
- pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height));
+ pe.Graphics.FillRectangle(CreateTexture(), new RectangleF(0, 0, (float)width, this.Height));
}
else
{
@@ -166,7 +195,7 @@ namespace ShiftOS.WinForms.Controls
int position = i * (BlockSize + 2);
if (ProgressImage != null)
{
- pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height));
+ pe.Graphics.FillRectangle(CreateTexture(), new Rectangle(position, 0, BlockSize, this.Height));
}
else
@@ -178,7 +207,7 @@ namespace ShiftOS.WinForms.Controls
case ProgressBarStyle.Marquee:
if (ProgressImage != null)
{
- pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height));
+ pe.Graphics.FillRectangle(CreateTexture(), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height));
}
else
{