WPF ClipToBounds True or false

FredGrit發表於2024-09-03
<Window x:Class="WpfApp333.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:WpfApp333" MouseWheel="Window_MouseWheel"
        mc:Ignorable="d" WindowState="Maximized"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Viewbox ClipToBounds="False">
            <Image Source="/WpfApp333;component/Images/1.jpg" Stretch="None">
                <Image.RenderTransform>
                    <ScaleTransform x:Name="scaler"/>
                </Image.RenderTransform>
            </Image>
        </Viewbox>
    </Grid>
</Window>

When ClipToBounds="True"

相關文章