■ RadialGradientBrush 엘리먼트를 사용하는 방법을 보여준다.
▶ 예제 코드 (XAML)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Page.Resources> <Style TargetType="{x:Type Rectangle}"> <Setter Property="Margin" Value="10" /> <Setter Property="Width" Value="150" /> <Setter Property="Height" Value="150" /> <Setter Property="Stroke" Value="White" /> <Setter Property="StrokeThickness" Value="1" /> </Style> <Style TargetType="{x:Type Ellipse}"> <Setter Property="Margin" Value="10" /> <Setter Property="Width" Value="150" /> <Setter Property="Height" Value="150" /> <Setter Property="Stroke" Value="White" /> <Setter Property="StrokeThickness" Value="1" /> </Style> </Page.Resources> <StackPanel Margin="10 10 10 10" Orientation="Horizontal" VerticalAlignment="Top"> <Rectangle> <Rectangle.Fill> <RadialGradientBrush GradientOrigin="0.75 0.25"> <GradientStop Offset="0.0" Color="Yellow" /> <GradientStop Offset="0.5" Color="Orange" /> <GradientStop Offset="1.0" Color="Red" /> </RadialGradientBrush> </Rectangle.Fill> </Rectangle> <Ellipse> <Ellipse.Fill> <RadialGradientBrush GradientOrigin="0.75 0.25"> <GradientStop Offset="0.0" Color="White" /> <GradientStop Offset="0.5" Color="MediumBlue" /> <GradientStop Offset="1.0" Color="Black" /> </RadialGradientBrush> </Ellipse.Fill> </Ellipse> <Ellipse> <Ellipse.Fill> <RadialGradientBrush GradientOrigin="0.75 0.25"> <GradientStop Offset="0.0" Color="AliceBlue" /> <GradientStop Offset="0.5" Color="Purple" /> <GradientStop Offset="1.0" Color="#330033" /> </RadialGradientBrush> </Ellipse.Fill> </Ellipse> <Ellipse> <Ellipse.Fill> <RadialGradientBrush GradientOrigin="0.75 0.25"> <GradientStop Offset="0.0" Color="Yellow" /> <GradientStop Offset="0.5" Color="Orange" /> <GradientStop Offset="1.0" Color="Red" /> </RadialGradientBrush> </Ellipse.Fill> </Ellipse> </StackPanel> </Page> |