一、窗体变透明,需要加三个属性:

AllowsTransparency="True"
Background="Transparent"
WindowStyle="None"

 

二、利用win32接口实现窗体鼠标事件穿透

Win32 API:

private const int WS_EX_TRANSPARENT = 0x20;

private const int GWL_EXSTYLE = -20;

[DllImport("user32", EntryPoint = "SetWindowLong")]
private static extern uint SetWindowLong(IntPtr hwnd, int nIndex, uint dwNewLong);

[DllImport("user32", EntryPoint = "GetWindowLong")]
private static extern uint GetWindowLong(IntPtr hwnd, int nIndex);
View Code

相关文章: