diff options
| author | Michael <[email protected]> | 2017-08-09 14:17:51 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-08-09 14:17:51 -0400 |
| commit | cc6fc6c0088ee3b81437254cbaf6241f91b3d95c (patch) | |
| tree | 7cee68e5099db5c35d6872ab47576607835f2976 /ShiftOS.Frontend/GUI/Button.cs | |
| parent | 72fe64f28d02cf41aa90b636608421e9b86ab896 (diff) | |
| download | shiftos_thereturn-monogame.tar.gz shiftos_thereturn-monogame.tar.bz2 shiftos_thereturn-monogame.zip | |
stuffmonogame
Diffstat (limited to 'ShiftOS.Frontend/GUI/Button.cs')
| -rw-r--r-- | ShiftOS.Frontend/GUI/Button.cs | 13 |
1 files changed, 5 insertions, 8 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); |
