[英]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
屬性在鏈接頁面中的作用:
對於特定位置,大小和旋轉的大多數弧,可以繪制四種不同的弧;
IsLargeArc
和SweepDirection
屬性指示要使用的弧。
因此,刪除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.