首页 > 其他分享 >WPF Image DrawingImage Drawing GeometryDrawing GeometryDrawing.Geometry GeometryGroup GeometryDrawin

WPF Image DrawingImage Drawing GeometryDrawing GeometryDrawing.Geometry GeometryGroup GeometryDrawin

时间:2024-12-07 21:20:46浏览次数:2  
标签:Geometry Image GeometryGroup Pen GeometryDrawing DrawingImage

<Window x:Class="WpfApp56.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"
        WindowStyle="None"
        xmlns:local="clr-namespace:WpfApp56"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" Background="Transparent">
    <Border BorderBrush="Transparent" BorderThickness="5"
            HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10">
        <Image Stretch="None" HorizontalAlignment="Left">
            <Image.Source>
                <DrawingImage PresentationTraceSources.TraceLevel="High">
                    <DrawingImage.Drawing>
                        <GeometryDrawing>
                            <GeometryDrawing.Geometry>
                                <GeometryGroup>
                                    <EllipseGeometry Center="0,0" RadiusX="750" RadiusY="200"/>
                                    <EllipseGeometry Center="0,0" RadiusX="300" RadiusY="450"/>
                                </GeometryGroup>
                            </GeometryDrawing.Geometry>
                            <GeometryDrawing.Brush>
                                <LinearGradientBrush>
                                    <GradientStop Offset="0.0" Color="Blue"/>
                                    <GradientStop Offset="1.0" Color="Red"/>
                                </LinearGradientBrush>
                            </GeometryDrawing.Brush>
                            <GeometryDrawing.Pen>
                                <Pen Thickness="10" Brush="Yellow"/>
                            </GeometryDrawing.Pen>
                        </GeometryDrawing>
                    </DrawingImage.Drawing>
                </DrawingImage>
            </Image.Source>
        </Image>
    </Border>
</Window>

 

 

 

标签:Geometry,Image,GeometryGroup,Pen,GeometryDrawing,DrawingImage
From: https://www.cnblogs.com/Fred1987/p/18592688

相关文章