Shapes.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="345" Width="366" x:Class="AvaloniaUI.Shapes" Title="Shapes"> <Grid RowDefinitions="auto,*"> <StackPanel> <Ellipse Fill="Yellow" Stroke="Blue" StrokeThickness="1" Width="100" Height="50" Margin="5" HorizontalAlignment="Left"></Ellipse> <Rectangle Fill="Yellow" Stroke="Blue" StrokeThickness="1" Width="100" Height="50" Margin="5" HorizontalAlignment="Left"></Rectangle> </StackPanel> <Rectangle Fill="Blue" Height="1" VerticalAlignment="Bottom"></Rectangle> <Canvas Grid.Row="1"> <Ellipse Fill="Yellow" Stroke="Blue" Canvas.Left="100" Canvas.Top="50" StrokeThickness="1" Width="100" Height="50" ></Ellipse> <Rectangle Fill="Yellow" Stroke="Blue" Canvas.Left="30" Canvas.Top="40" StrokeThickness="1" Width="100" Height="50" ></Rectangle> </Canvas> </Grid> </Window>
Shapes.axaml.cs代码
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace AvaloniaUI;
public partial class Shapes : Window
{
public Shapes()
{
InitializeComponent();
}
}
运行效果

浙公网安备 33010602011771号