diff --git a/Wox/Helper/DWMDropShadow.cs b/Wox/Helper/DWMDropShadow.cs index b50dff4b64..60253f8c06 100644 --- a/Wox/Helper/DWMDropShadow.cs +++ b/Wox/Helper/DWMDropShadow.cs @@ -50,10 +50,8 @@ namespace Wox.Helper { WindowInteropHelper helper = new WindowInteropHelper(window); int val = 2; - int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4); - window.Background = Brushes.Transparent; - HwndSource.FromHwnd(helper.Handle).CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0); - + int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4); + if (ret1 == 0) { Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 }; diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 245968619f..3c47eb06e6 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -8,6 +8,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Forms; using System.Windows.Input; +using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Animation; using WindowsInput; @@ -97,6 +98,9 @@ namespace Wox if (UserSettingStorage.Instance.OpacityMode == OpacityMode.DWM) DwmDropShadow.DropShadowToWindow(this); + this.Background = Brushes.Transparent; + HwndSource.FromHwnd(new WindowInteropHelper(this).Handle).CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0); + WindowIntelopHelper.DisableControlBox(this); } diff --git a/Wox/Themes/Aero Dark.xaml b/Wox/Themes/Aero Dark.xaml index 5350d2fce4..7d83892a10 100644 --- a/Wox/Themes/Aero Dark.xaml +++ b/Wox/Themes/Aero Dark.xaml @@ -16,7 +16,7 @@ diff --git a/Wox/Themes/Aero Light.xaml b/Wox/Themes/Aero Light.xaml index 73d7c0c3b5..d659259003 100644 --- a/Wox/Themes/Aero Light.xaml +++ b/Wox/Themes/Aero Light.xaml @@ -16,7 +16,7 @@