在WPF/C中画一个半圆/半圆#

ste*_*wpf 5 c# wpf graphics geometry 2d

我需要在WPF中绘制一个半圆/半圆.知道怎么做吗?谢谢你的提示!

Cha*_*lie 8

ArcSegment 这将是一个很好的起点.

这里是如何在代码中使用它一个很好的例子.

  • 可能是这个http://blogs.vertigo.com/personal/ralph/Blog/Lists/Posts/Post.aspx?ID=5 (2认同)
  • 第二个环节已经死了......答案本身的一些信息将受到高度赞赏. (2认同)

Vic*_*aru 8

由于原始链接已失效,以下是我绘制弧线的方法:

<Canvas>
    <Path Stroke="Gray">
        <Path.Data>
            <PathGeometry>
                <PathGeometry.Figures>
                    <PathFigureCollection>
                        <PathFigure StartPoint="0,20">
                            <PathFigure.Segments>
                                <PathSegmentCollection>
                                    <ArcSegment Size="20, 20"
                                    IsLargeArc="True"
                                    SweepDirection="CounterClockwise"
                                    Point="40,20" />
                                </PathSegmentCollection>
                            </PathFigure.Segments>
                        </PathFigure>
                    </PathFigureCollection>
                </PathGeometry.Figures>
            </PathGeometry>
        </Path.Data>
    </Path>
</Canvas>
Run Code Online (Sandbox Code Playgroud)

这会产生以下图像(为某些变量添加了标记)

在此输入图像描述

上面的 XAML 是此处 XAML 的修改版本:

https://www.c-sharpcorner.com/UploadFile/mahesh/drawing-arc-using-arcsegment-in-xaml/