💩 优化一部分代码
This commit is contained in:
@@ -45,7 +45,7 @@ namespace GeekDesk.Util
|
||||
else
|
||||
{
|
||||
LinearGradientBrush lgb = new LinearGradientBrush();
|
||||
|
||||
lgb.Opacity = (double)(Math.Round((decimal)(appConfig.BgOpacity / 100.00), 2));
|
||||
GradientStop gs = new GradientStop
|
||||
{
|
||||
Color = (Color)ColorConverter.ConvertFromString(appConfig.GradientBGParam.Color1),
|
||||
|
||||
@@ -50,20 +50,24 @@ namespace GeekDesk.Util
|
||||
|
||||
public static void EnableBlur(Window window)
|
||||
{
|
||||
var windowHelper = new WindowInteropHelper(window);
|
||||
WindowInteropHelper windowHelper = new WindowInteropHelper(window);
|
||||
|
||||
var accent = new AccentPolicy();
|
||||
accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND;
|
||||
AccentPolicy accent = new AccentPolicy
|
||||
{
|
||||
AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND
|
||||
};
|
||||
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
int accentStructSize = Marshal.SizeOf(accent);
|
||||
|
||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
IntPtr accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||
|
||||
var data = new WindowCompositionAttributeData();
|
||||
data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
|
||||
data.SizeOfData = accentStructSize;
|
||||
data.Data = accentPtr;
|
||||
WindowCompositionAttributeData data = new WindowCompositionAttributeData
|
||||
{
|
||||
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||
SizeOfData = accentStructSize,
|
||||
Data = accentPtr
|
||||
};
|
||||
|
||||
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user