WPF Image Image.Source DrawingImage DrawingImage.Drawing DrawingGroup ImageDrawing rect ImageSource

<Window x:Class="WpfApp57.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"
        WindowState="Maximized" Background="Transparent"
        xmlns:local="clr-namespace:WpfApp57"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Border BorderBrush="Blue" BorderThickness="5"
           HorizontalAlignment="Left" 
           VerticalAlignment="Top"
           Margin="20">
        <Image Stretch="None">
            <Image.Source>
                <DrawingImage>
                    <DrawingImage.Drawing>
                        <DrawingGroup>
                            <ImageDrawing Rect="0,0,200,400"
                                          ImageSource="Images/1.jpg"/>
                            <ImageDrawing Rect="0,450,450,400"
                                          ImageSource="Images/2.jpg"/>
                            <ImageDrawing Rect="400,0,800,800"
                                          ImageSource="Images/3.jpg"/>
                            <ImageDrawing Rect="200,0,200,400"
                                          ImageSource="Images/4.jpg"/>
                        </DrawingGroup>
                    </DrawingImage.Drawing>
                </DrawingImage>
            </Image.Source>
        </Image>
    </Border>
</Window>

 

 

 

 

 

posted @ 2024-12-07 21:35  FredGrit  阅读(26)  评论(0)    收藏  举报