簡體   English   中英

在WPF / C中繪制一個半圓/半圓#

[英]Draw a semicircle / half circle in WPF / C#

我需要在WPF中繪制一個半圓/半圓。 知道怎么做嗎? 謝謝你的提示!

ArcSegment將是一個很好的起點。

是一個如何在代碼中使用它的一個很好的例子。

由於原始鏈接已死,以下是我能夠繪制弧線的方法:

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

這會產生以下圖像(為某些變量添加了標記)

在此輸入圖像描述

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM