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/Desktop | |
| parent | 72fe64f28d02cf41aa90b636608421e9b86ab896 (diff) | |
| download | shiftos_thereturn-monogame.tar.gz shiftos_thereturn-monogame.tar.bz2 shiftos_thereturn-monogame.zip | |
stuffmonogame
Diffstat (limited to 'ShiftOS.Frontend/Desktop')
| -rw-r--r-- | ShiftOS.Frontend/Desktop/Desktop.cs | 16 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Desktop/WindowManager.cs | 2 |
2 files changed, 8 insertions, 10 deletions
diff --git a/ShiftOS.Frontend/Desktop/Desktop.cs b/ShiftOS.Frontend/Desktop/Desktop.cs index 352c764..82c7b9a 100644 --- a/ShiftOS.Frontend/Desktop/Desktop.cs +++ b/ShiftOS.Frontend/Desktop/Desktop.cs @@ -119,16 +119,14 @@ namespace ShiftOS.Frontend.Desktop int y = 0; int height = 0; int[] widths = new int[items.Length]; - using(var gfx = System.Drawing.Graphics.FromImage(new System.Drawing.Bitmap(1, 1))) - { LauncherItems.Clear(); for(int i = 0; i < items.Length; i++) { string name = Localization.Parse(items[i].DisplayData.Name); - var measure = gfx.SmartMeasureString(name, LoadedSkin.MainFont); - if (height < (int)measure.Height) - height = (int)measure.Height; - widths[i] = 120 + (int)measure.Width; + var measure = GraphicsContext.MeasureString(name, LoadedSkin.MainFont); + if (height < (int)measure.Y) + height = (int)measure.Y; + widths[i] = 120 + (int)measure.X; } @@ -148,7 +146,7 @@ namespace ShiftOS.Frontend.Desktop y += item.Height; } - } + Invalidate(); } @@ -297,7 +295,7 @@ namespace ShiftOS.Frontend.Desktop { gfx.DrawRectangle(al_left.X, dp_position + al_left.Y, holderSize.Width, holderSize.Height, UIManager.SkinTextures["applauncher"]); } - var altextmeasure = gfx.MeasureString(LoadedSkin.AppLauncherText, LoadedSkin.AppLauncherFont); + var altextmeasure = GraphicsContext.MeasureString(LoadedSkin.AppLauncherText, LoadedSkin.AppLauncherFont); int altextx = (holderSize.Width - (int)altextmeasure.X) / 2; int altexty = (holderSize.Height - (int)altextmeasure.Y) / 2; gfx.DrawString(LoadedSkin.AppLauncherText, altextx, altexty, LoadedSkin.AppLauncherTextColor.ToMonoColor(), LoadedSkin.AppLauncherFont); @@ -307,7 +305,7 @@ namespace ShiftOS.Frontend.Desktop var panelClockTextColor = LoadedSkin.DesktopPanelClockColor.ToMonoColor(); - var measure = gfx.MeasureString(dateTimeString, LoadedSkin.DesktopPanelClockFont); + var measure = GraphicsContext.MeasureString(dateTimeString, LoadedSkin.DesktopPanelClockFont); int panelclockleft = Width - (int)measure.X; int panelclockwidth = Width - panelclockleft; diff --git a/ShiftOS.Frontend/Desktop/WindowManager.cs b/ShiftOS.Frontend/Desktop/WindowManager.cs index b130b03..60f9e26 100644 --- a/ShiftOS.Frontend/Desktop/WindowManager.cs +++ b/ShiftOS.Frontend/Desktop/WindowManager.cs @@ -348,7 +348,7 @@ namespace ShiftOS.Frontend.Desktop gfx.DrawRectangle(titlebarleft, 0, titlebarwidth, titleheight, UIManager.SkinTextures["titlebar"]); } //Now we draw the title text. - var textMeasure = gfx.MeasureString(Text, titlefont); + var textMeasure = GraphicsContext.MeasureString(Text, titlefont); PointF textloc; if (titletextcentered) textloc = new PointF((titlebarwidth - textMeasure.X) / 2, |
