带弯曲斜边的多边形三角形

Polygon Triangle with Curved Hypotenuse

我可以使用以下 XAML 创建一个多边形:

<Polygon Grid.Row="1"
         Grid.Column="1"
         Fill="{StaticResource GreenBrush}"
         Points="0,1 1,1 1,0"
         Stretch="Fill" />

这会产生一个直角三角形 hypotenuse.However 我想要一个弯曲的斜边。这可能使用多边形吗?如果不是,我该如何实现目标?

上面的XAML给出了左手三角形,但是我想要一些关于右手三角形的东西。

我觉得这可能很简单,但我就是想不通

也许这会对你有所帮助:)

here

更新:

好的,所以这个代码:

<Canvas HorizontalAlignment="Left" Height="326" Margin="167,56,0,0" VerticalAlignment="Top" Width="311" MouseEnter="Canvas_MouseEnter" Background="#FFC7C5C5">
        <Path Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="10,100">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                        <QuadraticBezierSegment Point1="200,150" Point2="300,100" />                                            
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                            <PathFigure StartPoint="10,100">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                        <LineSegment Point="10,300"></LineSegment>
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                            <PathFigure StartPoint="10,300">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                        <LineSegment Point="300,100"></LineSegment>
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
    </Canvas>

将使这个数字:

问题是因为多边形只允许直线实现曲线效果会很困难
你有两个选择
1)使用混合创建路径
例如

<Path Data="M0.037120935,318.97711 L3.0000002,319 0,319 z M517,5.0000003 L517,319 3.0000002,319 C286.87436,319 517,178.4174 517,5.0000003 z M517,0 L517,5.0000003 516.89777,0.063097671 z" Fill="#FFFB0404" Stretch="Fill"/>

2)首先创建三角形并将其斜边与椭圆重叠。

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid x:Name="grid">
        <Polygon         
         Points="0,1 1,1 1,0"
         Stretch="Fill" Fill="#FF69FB04" />
        <Ellipse Fill="White" HorizontalAlignment="Left" Height="628" Margin="-511,-309,0,0" VerticalAlignment="Top" Width="1028"/>
        </Grid>

</Window>