终于使用VB.net实现了Aero效果
vb.net吧
全部回复
仅看楼主
level 4
110schoolx 楼主
有图为证,是使用系统API实现的,Aero效果在Vista及以上系统中均可用,在XP及以下系统中则为半透明(无高斯模糊),如图是在win10系统下实现的。
另外,控件也都实现了背景透明。
2021年11月01日 11点11分 1
level 4
110schoolx 楼主
在背景为暗色条件下还特地添加了控件背景,方便控件中文字的阅读[开心]
2021年11月01日 11点11分 2
level 4
110schoolx 楼主
随便加了一些控件什么的
2021年11月01日 11点11分 3
level 2
楼猪不要自娱自乐!讲讲如何实现呗·~~~~~[哈哈]
2021年12月31日 07点12分 4
level 2
纯炫技,又不讲干货
2026年04月21日 01点04分 5
level 14
透明、半透明(包括控件)是vb.net本来就有的,但高斯模糊要用哪个API?
2026年05月03日 05点05分 6
level 9
这个我熟:
Public Class WindowsBlurEffect
Public Sub EnableBlur(targetWindow As Window)
Dim windowHelper = New System.Windows.Interop.WindowInteropHelper(targetWindow)
Dim accent As New AccentPolicy With {.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND}
Dim accentStructSize As Integer = Runtime.InteropServices.Marshal.SizeOf(accent)
Dim accentPtr As IntPtr = Runtime.InteropServices.Marshal.AllocHGlobal(accentStructSize)
Try
Runtime.InteropServices.Marshal.StructureToPtr(accent, accentPtr, False)
Dim data As New WindowCompositionAttributeData With {.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,.SizeOfData = accentStructSize,.Data = accentPtr}
SetWindowCompositionAttribute(windowHelper.Handle, data)
Finally
Runtime.InteropServices.Marshal.FreeHGlobal(accentPtr)
End Try
End Sub
<Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)>
Private Structure AccentPolicy
Public AccentState As AccentState
Public AccentFlags As Integer
Public GradientColor As Integer
Public AnimationId As Integer
End Structure
Private Enum AccentState
ACCENT_DISABLED = 0
ACCENT_ENABLE_GRADIENT = 1
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2
ACCENT_ENABLE_BLURBEHIND = 3
ACCENT_ENABLE_ACRYLICBLURBEHIND = 4
ACCENT_ENABLE_HOSTBACKDROP = 5
End Enum
<Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)>
Private Structure WindowCompositionAttributeData
Public Attribute As WindowCompositionAttribute
Public Data As IntPtr
Public SizeOfData As Integer
End Structure
Private Enum WindowCompositionAttribute
WCA_ACCENT_POLICY = 19
End Enum
<Runtime.InteropServices.DllImport("user32.dll")>
Private Shared Function SetWindowCompositionAttribute(hWnd As IntPtr, ByRef data As WindowCompositionAttributeData) As Integer
End Function
End Class
2026年05月18日 17点05分 7
1