From cc6fc6c0088ee3b81437254cbaf6241f91b3d95c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 9 Aug 2017 14:17:51 -0400 Subject: stuff --- ShiftOS.Frontend/Desktop/Desktop.cs | 16 +++++++--------- ShiftOS.Frontend/Desktop/WindowManager.cs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'ShiftOS.Frontend/Desktop') 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, -- cgit v1.2.3