Last active
December 10, 2022 08:08
-
-
Save riverar/fd6525579d6bbafc6e48 to your computer and use it in GitHub Desktop.
C# structures to implement "Aero Glass" blur on Windows 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("user32.dll")] | |
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); | |
[StructLayout(LayoutKind.Sequential)] | |
internal struct WindowCompositionAttributeData | |
{ | |
public WindowCompositionAttribute Attribute; | |
public IntPtr Data; | |
public int SizeOfData; | |
} | |
internal enum WindowCompositionAttribute | |
{ | |
// ... | |
WCA_ACCENT_POLICY = 19 | |
// ... | |
} | |
internal enum AccentState | |
{ | |
ACCENT_DISABLED = 0, | |
ACCENT_ENABLE_GRADIENT = 1, | |
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, | |
ACCENT_ENABLE_BLURBEHIND = 3, | |
ACCENT_INVALID_STATE = 4 | |
} | |
[StructLayout(LayoutKind.Sequential)] | |
internal struct AccentPolicy | |
{ | |
public AccentState AccentState; | |
public int AccentFlags; | |
public int GradientColor; | |
public int AnimationId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My example here, in Chinese but the code itself should be self-explanatory
https://www.kechuang.org/t/79675