簡體   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