形成一个角度的角

Form corners cut at an angle

如何使表格中的角切割成一定角度? 也许与 Viewbox 有关?

这有点笨拙并且有一些注意事项,但它几乎可以满足您的要求。它只是一个包含边框的透明 Window。 Border 应用了 Clip 蒙版,将 20 x 20 x 20 像素边的三角形从角上移除。如果您想在上图的两侧包含 'trenches',您需要做的就是向 Border 的 PathFigure 添加更多的 LineSegment。

您目前无法调整 Window 的大小。如果您确实实现了调整大小,则需要挂钩 Border 的 SizeChanged 事件以在代码隐藏中动态更改 Border 剪切路径的坐标。

Window 没有 maximise/minimise/close 控件。您需要自己实施这些。不应该太大的工作。

<Window x:Class="MvvmLight4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:ignore="http://www.ignore.com"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Width="1024"
        Height="768"
        AllowsTransparency="True"
        Background="Transparent"
        WindowStartupLocation="CenterScreen"
        WindowStyle="None"
        mc:Ignorable="d ignore"
        x:Name="myWindow">

    <Border Background="Black">
        <Border.Clip>
            <PathGeometry>
                <PathFigure StartPoint="0,0">
                    <LineSegment Point="20,0" />
                    <LineSegment Point="1004,0" />
                    <LineSegment Point="1024,20" />
                    <LineSegment Point="1024,748" />
                    <LineSegment Point="1004,768" />
                    <LineSegment Point="20,768" />
                    <LineSegment Point="0,748" />
                    <LineSegment Point="0,20" />
                    <LineSegment Point="20,0" />
                </PathFigure>
            </PathGeometry>
        </Border.Clip>

        <!-- All of your everything else needs to go inside the border -->

    </Border>

</Window>