WPF LinearGradientBrush SpreadMethod,Pad,Reflect,Repeat

<Window x:Class="WpfApp91.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:WpfApp91"
        WindowState="Maximized"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Ellipse Grid.Column="0">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0.45,0.45" 
                                     EndPoint="0.55,0.55"
                                     SpreadMethod="Pad">
                    <GradientStop Offset="0" Color="Blue"/>
                    <GradientStop Offset="1" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse Grid.Column="1">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0.45,0.45" 
                                     EndPoint="0.55,0.55"
                             SpreadMethod="Reflect">
                    <GradientStop Offset="0" Color="Blue"/>                   
                    <GradientStop Offset="1" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
        <Ellipse Grid.Column="2">
            <Ellipse.Fill>
                <LinearGradientBrush StartPoint="0.45,0.45"
                                     EndPoint="0.55,0.55"
                                     SpreadMethod="Repeat">
                    <GradientStop Offset="0" Color="Blue"/>
                    <GradientStop Offset="1" Color="Red"/>
                </LinearGradientBrush>
            </Ellipse.Fill>
        </Ellipse>
    </Grid>
</Window>

 

 

 

 

posted @ 2024-12-22 21:43  FredGrit  阅读(1)  评论(0编辑  收藏  举报