步骤一:到下面的连接中下载源码:
https://archive.codeplex.com/?p=microsoftdwayneneed
根据自己项目所用的.net framework版本编译对应版本的dll,得到下面2个dll
Microsoft.DwayneNeed.dll
Microsoft.DwayneNeed.Win32.dll
在项目中添加引用,引入命名空间:
xmlns:airspace="clr-namespace:Microsoft.DwayneNeed.Interop;assembly=Microsoft.DwayneNeed"
xmal中写法:
<Grid>
<airspace:AirspaceDecorator AirspaceMode="Redirect" IsInputRedirectionEnabled="True" IsOutputRedirectionEnabled="True">
<WindowsFormsHost Name="FormsHost">
<wf:Panel x:Name="PART_PanelContainer"/>
</WindowsFormsHost>
</airspace:AirspaceDecorator>
</Grid>
实现效果:
如果没有上面dll的帮忙,上图中上下透明层不会动画的展开或收起。
看了上面2个dll的源码,佩服这牛逼的项目和代码!
参考blog:
https://www.cnblogs.com/tianciliangen/p/5614075.html
https://www.cnblogs.com/nabian/p/6693203.html