繁体   English   中英

WPF - IsLargeArc =“false”不再起作用

[英]WPF - IsLargeArc=“false” doesn't work anymore

我最近想使用ArcSegment ,但是IsLargeArc="False"不起作用。 这是带有已编译应用程序图片的示例代码。

图片是:

在此输入图像描述

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="1000" Width="1000">
    <Canvas Height="500" Width="500">
        <Path Stroke="Red" StrokeThickness="3">
            <Path.Data>
                <PathGeometry>
                    <PathFigure StartPoint="50, 50">
                        <ArcSegment Point="300, 50" IsLargeArc="False" Size="50,25" />
                    </PathFigure>
                </PathGeometry>
            </Path.Data>
        </Path>
        <Path Stroke="Green" StrokeThickness="3">
            <Path.Data>
                <PathGeometry>
                    <PathFigure StartPoint="50, 250">
                        <ArcSegment Point="300, 250" IsLargeArc="True" Size="50,25" />
                    </PathFigure>
                </PathGeometry>
            </Path.Data>
        </Path>
    </Canvas>
</Window>

直到你的弧的大小不允许两个不同的渲染选项IsLargeArc不会有任何区别

尝试这个xaml,我只是修改了你的xaml中的弧的大小

<Canvas Height="500"
        Width="500">
    <Path Stroke="Red"
          StrokeThickness="3">
        <Path.Data>
            <PathGeometry>
                <PathFigure StartPoint="50, 50">
                    <ArcSegment Point="300, 50"
                                IsLargeArc="False"
                                Size="150,25" />
                </PathFigure>
            </PathGeometry>
        </Path.Data>
    </Path>
    <Path Stroke="Green"
          StrokeThickness="3">
        <Path.Data>
            <PathGeometry>
                <PathFigure StartPoint="50, 250">
                    <ArcSegment Point="300, 250"
                                IsLargeArc="True"
                                Size="150,25" />
                </PathFigure>
            </PathGeometry>
        </Path.Data>
    </Path>
</Canvas>

结果

结果

也许您还没有完全理解ArcSegment.IsLargeArc属性在链接页面中的作用:

对于特定位置,大小和旋转的大多数弧,可以绘制四种不同的弧; IsLargeArcSweepDirection属性指示要使用的弧。

因此,删除Point设置并添加SweepDirection设置,我们可以看到明显的区别:

<Canvas Height="500" Width="500">
    <Path Stroke="Red" StrokeThickness="3">
        <Path.Data>
            <PathGeometry>
                <PathFigure StartPoint="50, 50">
                    <ArcSegment IsLargeArc="False" Size="50,25" SweepDirection="Clockwise" />
                </PathFigure>
            </PathGeometry>
        </Path.Data>
    </Path>
    <Path Stroke="Green" StrokeThickness="3">
        <Path.Data>
            <PathGeometry>
                <PathFigure StartPoint="50, 250">
                    <ArcSegment IsLargeArc="True" Size="50,25" SweepDirection="Counterclockwise" />
                </PathFigure>
            </PathGeometry>
        </Path.Data>
    </Path>
</Canvas>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM