RoundedRectangles.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="449" Width="340"
        x:Class="AvaloniaUI.RoundedRectangles"
        Title="RoundedRectangles">
    <StackPanel>
        <TextBlock Margin="5,5,0,0">Corner radius of 5.</TextBlock>
        <Rectangle Fill="Yellow" Stroke="Blue" StrokeThickness="1" RadiusX="5" RadiusY="5"
                   Width="100" Height="60" Margin="5"  HorizontalAlignment="Left"/>

        <TextBlock Margin="5,5,0,0">Corner radius of 10.</TextBlock>
        <Rectangle Fill="Yellow" Stroke="Blue" StrokeThickness="1" RadiusX="10" RadiusY="10"
                   Width="100" Height="60" Margin="5"  HorizontalAlignment="Left"/>

        <TextBlock Margin="5,5,0,0">Corner radius of 10 (X) and 25 (Y).</TextBlock>
        <Rectangle Fill="Yellow" Stroke="Blue" StrokeThickness="1" RadiusX="10" RadiusY="25"
                   Width="100" Height="60" Margin="5"  HorizontalAlignment="Left"/>

        <TextBlock Margin="5,5,0,0">Corner radius of 50 (X) and 30 (Y).</TextBlock>
        <Rectangle Fill="Yellow" Stroke="Blue" StrokeThickness="1" RadiusX="50" RadiusY="30"
                   Width="100" Height="60" Margin="5"  HorizontalAlignment="Left"/>
    </StackPanel>
</Window>

RoundedRectangles.axaml.cs代码

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

namespace AvaloniaUI;

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

运行效果

image

 

posted on 2025-09-03 11:27  dalgleish  阅读(7)  评论(0)    收藏  举报