diff options
Diffstat (limited to 'ShiftOS.Frontend/GUI')
| -rw-r--r-- | ShiftOS.Frontend/GUI/Button.cs | 13 | ||||
| -rw-r--r-- | ShiftOS.Frontend/GUI/ListView.cs | 2 | ||||
| -rw-r--r-- | ShiftOS.Frontend/GUI/TextControl.cs | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/ShiftOS.Frontend/GUI/Button.cs b/ShiftOS.Frontend/GUI/Button.cs index 62db283..f1bbb9c 100644 --- a/ShiftOS.Frontend/GUI/Button.cs +++ b/ShiftOS.Frontend/GUI/Button.cs @@ -20,16 +20,13 @@ namespace ShiftOS.Frontend.GUI protected override void OnLayout(GameTime gameTime) { - if(AutoSize == true) + if (AutoSize == true) { int borderwidth = SkinEngine.LoadedSkin.ButtonBorderWidth * 2; - using (var gfx = Graphics.FromImage(new Bitmap(1, 1))) - { - var measure = gfx.MeasureString(this.Text, this.Font); - Width = borderwidth + (int)measure.Width + 16; - Height = borderwidth + (int)measure.Height + 12; - } + var measure = GraphicsContext.MeasureString(this.Text, this.Font); + Width = borderwidth + (int)measure.X + 16; + Height = borderwidth + (int)measure.Y + 12; } } @@ -45,7 +42,7 @@ namespace ShiftOS.Frontend.GUI gfx.DrawRectangle(0, 0, Width, Height, UIManager.SkinTextures["ControlTextColor"]); gfx.DrawRectangle(1, 1, Width - 2, Height - 2, bgCol); - var measure = gfx.MeasureString(Text, Font); + var measure = GraphicsContext.MeasureString(Text, Font); var loc = new Vector2((Width - measure.X) / 2, (Height - measure.Y) / 2); diff --git a/ShiftOS.Frontend/GUI/ListView.cs b/ShiftOS.Frontend/GUI/ListView.cs index d4f22a7..23765e4 100644 --- a/ShiftOS.Frontend/GUI/ListView.cs +++ b/ShiftOS.Frontend/GUI/ListView.cs @@ -163,7 +163,7 @@ namespace ShiftOS.Frontend.GUI image = _images[item.ImageKey]; } int textwidth = texwidth + (_itemimagemargin * 2); - var textmeasure = gfx.MeasureString(item.Text, LoadedSkin.MainFont, textwidth); + var textmeasure = GraphicsContext.MeasureString(item.Text, LoadedSkin.MainFont, textwidth); yhelper = Math.Max(yhelper, _itemy + texheight + (int)textmeasure.Y); if(image != null) diff --git a/ShiftOS.Frontend/GUI/TextControl.cs b/ShiftOS.Frontend/GUI/TextControl.cs index 1e23680..95d4291 100644 --- a/ShiftOS.Frontend/GUI/TextControl.cs +++ b/ShiftOS.Frontend/GUI/TextControl.cs @@ -57,7 +57,7 @@ namespace ShiftOS.Frontend.GUI protected override void OnPaint(GraphicsContext gfx) { - var sMeasure = gfx.MeasureString(_text, _font, Width); + var sMeasure = GraphicsContext.MeasureString(_text, _font, Width); PointF loc = new PointF(2, 2); float centerH = (Width - sMeasure.X) / 2; float centerV = (Height - sMeasure.Y) / 2; |
