첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ GeometryGroup 엘리먼트의 FillRule 속성을 사용하는 방법을 보여준다.

TestProject.zip
0.15MB

▶ MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <Path
        HorizontalOptions="Center"
        VerticalOptions="Center"
        WidthRequest="300"
        HeightRequest="300"
        StrokeThickness="10"
        Stroke="Black"
        Fill="#ccccff"
        Aspect="Fill">
        <Path.Data>
            <GeometryGroup FillRule="Nonzero">
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigure StartPoint="120,120">
                            <PathFigure.Segments>
                                <PathSegmentCollection>
                                    <ArcSegment
                                        Point="140,120"
                                        Size="50,50"
                                        IsLargeArc="True"
                                        SweepDirection="CounterClockwise" />
                                </PathSegmentCollection>
                            </PathFigure.Segments>
                        </PathFigure>
                        <PathFigure StartPoint="120,100">
                            <PathFigure.Segments>
                                <PathSegmentCollection>
                                    <ArcSegment
                                        Point="140,100"
                                        Size="70,70"
                                        IsLargeArc="True"
                                        SweepDirection="CounterClockwise" />
                                </PathSegmentCollection>
                            </PathFigure.Segments>
                        </PathFigure>
                        <PathFigure StartPoint="120,70">
                            <PathFigure.Segments>
                                <PathSegmentCollection>
                                    <ArcSegment
                                        Point="140,70"
                                        Size="100,100"
                                        IsLargeArc="True"
                                        SweepDirection="CounterClockwise" />
                                </PathSegmentCollection>
                            </PathFigure.Segments>
                        </PathFigure>
                        <PathFigure StartPoint="120,300">
                            <PathFigure.Segments>
                                <ArcSegment
                                    Point="140,300"
                                    Size="130,130"
                                    IsLargeArc="True"
                                    SweepDirection="Clockwise" />
                            </PathFigure.Segments>
                        </PathFigure>
                    </PathGeometry.Figures>
                </PathGeometry>
            </GeometryGroup>
        </Path.Data>
    </Path>
</ContentPage>

※ 프리뷰 버전 테스트시, Path 엘리먼트가 설정된 크기대로 표시되지 않고 화면 전체를 채운 상태로 표시되었다. 디버깅 모드에서 Path 엘리먼트의 WidthRequest/HeightRequest 속성을 반복적으로 변경하면 표시가 정상적으로 되었다.
※ 프리뷰 버전 테스트시, GeometryGroup 엘리먼트의 FillRule 속성을 Nonzero로 설정했으나 적용되지 않는 것 같다.

728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요