WPF Image Image clip EllipseGeometry

FredGrit發表於2024-06-15
<Window x:Class="WpfApp169.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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"
        xmlns:local="clr-namespace:WpfApp169"
        mc:Ignorable="d" WindowState="Maximized"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Image Source="/WpfApp169;component/cl1.jpg"/>
        <!--<Image Source="/WpfApp169;component/cl1.jpg">
            <Image.Clip>
                <EllipseGeometry RadiusX="770" RadiusY="460" Center="770,460"/>
            </Image.Clip>
        </Image>-->        
    </Grid>
</Window>

<Window x:Class="WpfApp169.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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"
        xmlns:local="clr-namespace:WpfApp169"
        mc:Ignorable="d" WindowState="Maximized"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <!--<Image Source="/WpfApp169;component/cl1.jpg"/>-->
        <Image Source="/WpfApp169;component/cl1.jpg">
            <Image.Clip>
                <EllipseGeometry RadiusX="770" RadiusY="460" Center="770,460"/>
            </Image.Clip>
        </Image>        
    </Grid>
</Window>

相關文章