aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GUI/TextControl.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-07-04 17:57:29 -0400
committerMichael <[email protected]>2017-07-04 17:57:29 -0400
commit2adb8859edb95921e8f6d3cbb41fdc349825d6f8 (patch)
treeaa1780fe7f8e2c7ab759429aa53717d7a14ca7ef /ShiftOS.Frontend/GUI/TextControl.cs
parent5515881e922de087f4e0f5db51ae681bcd7f70d6 (diff)
downloadshiftos_thereturn-2adb8859edb95921e8f6d3cbb41fdc349825d6f8.tar.gz
shiftos_thereturn-2adb8859edb95921e8f6d3cbb41fdc349825d6f8.tar.bz2
shiftos_thereturn-2adb8859edb95921e8f6d3cbb41fdc349825d6f8.zip
abandon system.drawing for anything other than text
Diffstat (limited to 'ShiftOS.Frontend/GUI/TextControl.cs')
-rw-r--r--ShiftOS.Frontend/GUI/TextControl.cs21
1 files changed, 11 insertions, 10 deletions
diff --git a/ShiftOS.Frontend/GUI/TextControl.cs b/ShiftOS.Frontend/GUI/TextControl.cs
index 9bc70e8..f1bbef1 100644
--- a/ShiftOS.Frontend/GUI/TextControl.cs
+++ b/ShiftOS.Frontend/GUI/TextControl.cs
@@ -4,6 +4,7 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using ShiftOS.Frontend.GraphicsSubsystem;
namespace ShiftOS.Frontend.GUI
{
@@ -53,19 +54,19 @@ namespace ShiftOS.Frontend.GUI
set { _textAlign = value; }
}
- protected override void OnPaint(Graphics gfx)
+ protected override void OnPaint(GraphicsContext gfx)
{
var sMeasure = gfx.MeasureString(_text, _font, Width);
PointF loc = new PointF(2, 2);
- float centerH = (Width - sMeasure.Width) / 2;
- float centerV = (Height - sMeasure.Height) / 2;
+ float centerH = (Width - sMeasure.X) / 2;
+ float centerV = (Height - sMeasure.Y) / 2;
switch (_textAlign)
{
case TextAlign.TopCenter:
loc.X = centerH;
break;
case TextAlign.TopRight:
- loc.X = Width - sMeasure.Width;
+ loc.X = Width - sMeasure.X;
break;
case TextAlign.MiddleLeft:
loc.Y = centerV;
@@ -76,23 +77,23 @@ namespace ShiftOS.Frontend.GUI
break;
case TextAlign.MiddleRight:
loc.Y = centerV;
- loc.X = (Width - sMeasure.Width);
+ loc.X = (Width - sMeasure.Y);
break;
case TextAlign.BottomLeft:
- loc.Y = (Height - sMeasure.Height);
+ loc.Y = (Height - sMeasure.Y);
break;
case TextAlign.BottomCenter:
- loc.Y = (Height - sMeasure.Height);
+ loc.Y = (Height - sMeasure.Y);
loc.X = centerH;
break;
case TextAlign.BottomRight:
- loc.Y = (Height - sMeasure.Height);
- loc.X = (Width - sMeasure.Width);
+ loc.Y = (Height - sMeasure.Y);
+ loc.X = (Width - sMeasure.X);
break;
}
- gfx.DrawString(_text, _font, new SolidBrush(Engine.SkinEngine.LoadedSkin.ControlTextColor), new RectangleF(loc.X, loc.Y, sMeasure.Width, sMeasure.Height));
+ gfx.DrawString(_text, 0, 0, Engine.SkinEngine.LoadedSkin.ControlTextColor.ToMonoColor(), _font, this.Width);
}
}