반응형
<Window x:Class="WpfApplication16.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Geometry Group" Height="350" Width="330"> <Window.Resources> <SolidColorBrush x:Key="MyGrayGridBrush" Color="YellowGreen"/> <GeometryGroup x:Key="GeometryNonzero" FillRule="Nonzero"> <EllipseGeometry RadiusX="50" RadiusY="50" Center="65,60"/> <EllipseGeometry RadiusX="30" RadiusY="30" Center="65,60"/> </GeometryGroup> <GeometryGroup x:Key="GeometryEvenOdd" FillRule="EvenOdd"> <EllipseGeometry RadiusX="50" RadiusY="50" Center="65,60"/> <EllipseGeometry RadiusX="30" RadiusY="30" Center="65,60"/> </GeometryGroup> </Window.Resources> <Border Margin="5" BorderBrush="Black" BorderThickness="1" Background="{StaticResource MyGrayGridBrush}" HorizontalAlignment="Left"> <Canvas Height="310" Width="300"> <Grid ShowGridLines="True" Height="265"> <Grid.ColumnDefinitions> <ColumnDefinition Width="140"/> <ColumnDefinition Width="140"/> </Grid.ColumnDefinitions> <StackPanel Margin="5" Grid.Column="0"> <TextBlock Text="FileRule = Nonzero" Margin="15,5,5,5"/> <Path Fill="LightBlue" Stroke="Blue" StrokeThickness="2" Data="{StaticResource GeometryNonzero}"/> <Path Fill="LightCoral" Stroke="Red" StrokeThickness="2" Canvas.Left="150" Data="{StaticResource GeometryNonzero}"/> </StackPanel> <StackPanel Margin="5" Grid.Column="1"> <TextBlock Text="FileRule = EvenOdd" Margin="15,5,5,5"/> <Path Fill="LightBlue" Stroke="Blue" StrokeThickness="2" Data="{StaticResource GeometryEvenOdd}"/> <Path Fill="LightCoral" Stroke="Red" StrokeThickness="2" Canvas.Left="150" Data="{StaticResource GeometryEvenOdd}"/> </StackPanel> </Grid> </Canvas> </Border> </Window>
reference : Practical WPF Graphics Programming
'.NET > WPF 2D' 카테고리의 다른 글
WPF 2D Geometry and Mini-Language (0) | 2013.07.11 |
---|---|
WPF 2D Bezier Curve (0) | 2013.07.11 |
WPF 2D PathGeometry Class (0) | 2013.07.11 |
WPF 2D Combined Geometry (0) | 2013.07.11 |
WPF Geometry and 2D Drawing (0) | 2013.07.11 |
WPF 2D Composite Transforms (0) | 2013.07.04 |
WPF 2D SkewTransform (0) | 2013.07.04 |
WPF 2D RotateTransform (0) | 2013.07.04 |