From de6a5ee4ac78f0680c5a5bff8a18caace983d09d Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 26 Feb 2017 11:17:30 -0500 Subject: [PATCH] attempt transparency fix --- ShiftOS.WinForms/WinformsDesktop.Designer.cs | 1 + ShiftOS.WinForms/WinformsDesktop.cs | 27 +++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 0585199..aef7296 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -76,6 +76,7 @@ namespace ShiftOS.WinForms this.desktoppanel.Name = "desktoppanel"; this.desktoppanel.Size = new System.Drawing.Size(1296, 24); this.desktoppanel.TabIndex = 0; + this.desktoppanel.Paint += new System.Windows.Forms.PaintEventHandler(this.desktoppanel_Paint); // // btnnotifications // diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 81079e4..73ad1bd 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -269,14 +269,28 @@ namespace ShiftOS.WinForms this.BackgroundImage = img; })); this.BackgroundImageLayout = GetImageLayout("desktopbackground"); - desktoppanel.BackgroundImage = ((Bitmap)GetImage("desktoppanel")); + + var pnlimg = GetImage("desktoppanel"); + if (pnlimg != null) + { + var bmp = new Bitmap(pnlimg); + bmp.MakeTransparent(Color.FromArgb(1, 0, 1)); + pnlimg = bmp; + } + + desktoppanel.BackgroundImage = pnlimg; if (desktoppanel.BackgroundImage != null) { - ((Bitmap)desktoppanel.BackgroundImage).MakeTransparent(Color.FromArgb(1, 0, 1)); desktoppanel.BackColor = Color.Transparent; } - menuStrip1.BackgroundImage = GetImage("applauncher"); - if (menuStrip1.BackgroundImage != null) ((Bitmap)menuStrip1.BackgroundImage).MakeTransparent(Color.FromArgb(1, 0, 1)); + var appimg = GetImage("applauncher"); + if (appimg != null) + { + var bmp = new Bitmap(appimg); + bmp.MakeTransparent(Color.FromArgb(1, 0, 1)); + appimg = bmp; + } + menuStrip1.BackgroundImage = appimg; lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; lbtime.Font = LoadedSkin.DesktopPanelClockFont; if (desktoppanel.BackgroundImage == null) @@ -557,6 +571,11 @@ namespace ShiftOS.WinForms { AppearanceManager.SetupWindow(new Applications.Notifications()); } + + private void desktoppanel_Paint(object sender, PaintEventArgs e) + { + e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; + } } [ShiftOS.Engine.Scripting.Exposed("desktop")]