控制“窗外/铬合金”在WPF中
-
03-07-2019 - |
题
有没有办法让控件/图像/等“超出” WPF中的Window / Chrome(即Aero的玻璃)?
我的意思是 WPF Yahoo Messenger 已经发布(然后停止)了一段时间。 WindowStyle看起来像是设置为None,但AllowTransparencies / CanResize分别设置为false / true - 并且avatar略微“超出窗口/ chrome”。
我知道我可以创建我自己的玻璃边框,但这可能需要付出相当大的努力才能使其看起来一致。
解决方案
是的,我相信您必须用自己的界面替换窗口的界面。您可以从透明窗口和网格开始,在网格周围留下一些边距。然后在网格上放置拇指,标题栏等来模拟窗口行为。网格周围的边距允许您在“窗口”之外绘制控件。
<Window
x:Class="TransparentFormDemo.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300"
AllowsTransparency="True"
WindowStyle="None" Background="Transparent">
<Grid Margin="20" Background="AliceBlue">
<Thumb Name="topThumb" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Top"
DragDelta="topThumb_DragDelta" Cursor="SizeNS"/>
<!--Thumbs continued-->
<Polygon Points="10,110 60,10 110,110" Fill="Blue" Margin="0,-30"/>
</Grid>
</Window>
不隶属于 StackOverflow