GroupedShapes.axaml代码

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Height="300" Width="300"
        x:Class="AvaloniaUI.GroupedShapes"
        Title="GroupedShapes">
    <Canvas>
        <TextBlock Canvas.Top="50" Canvas.Left="20" FontSize="25" FontWeight="Bold">Hello There</TextBlock>

        <Path Fill="Yellow" Stroke="Blue" StrokeThickness="1" Margin="5" Canvas.Top="10" Canvas.Left="10" >
            <Path.Data>
                <GeometryGroup FillRule="EvenOdd">
                    <RectangleGeometry Rect="0,0,100,100"></RectangleGeometry>
                    <EllipseGeometry Center="50,50" RadiusX="35" RadiusY="25"></EllipseGeometry>
                </GeometryGroup>
            </Path.Data>
        </Path>
    </Canvas>
</Window>

GroupedShapes.axaml.cs代码

using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace AvaloniaUI;

public partial class GroupedShapes : Window
{
    public GroupedShapes()
    {
        InitializeComponent();
    }
}

运行效果

image

 

posted on 2025-09-06 13:37  dalgleish  阅读(5)  评论(0)    收藏  举报