* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
2.5 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Create a Composite Shape | 03/30/2017 |
|
|
8e5c7ef4-d7ed-4c43-afc9-ca01325c300b |
How to: Create a Composite Shape
This example shows how to create composite shapes using xref:System.Windows.Media.Geometry objects and display them using a xref:System.Windows.Shapes.Path element. In the following example, a xref:System.Windows.Media.LineGeometry, xref:System.Windows.Media.EllipseGeometry, and a xref:System.Windows.Media.RectangleGeometry are used with a xref:System.Windows.Media.GeometryGroup to create a composite shape. The geometries are then drawn using a xref:System.Windows.Shapes.Path element.
Example
[!code-xamlGeometrySample#19]
[!code-csharpGeometriesMiscSnippets_procedural_snip#CompositeShapeCodeExampleInline1] [!code-vbGeometriesMiscSnippets_procedural_snip#CompositeShapeCodeExampleInline1]
The following illustration shows the shape created in the previous example.
More complex shapes, such as polygons and shapes with curved segments, may be created using a xref:System.Windows.Media.PathGeometry. For an example showing how to create a shape using a xref:System.Windows.Media.PathGeometry, see Create a Shape by Using a PathGeometry. Although this example renders a shape to the screen using a xref:System.Windows.Shapes.Path element, xref:System.Windows.Media.Geometry objects may also be used to describe the contents of a xref:System.Windows.Media.GeometryDrawing or a xref:System.Windows.Media.DrawingContext. They may also be used for clipping and hit-testing.
This example is part of larger sample; for the complete sample, see the Geometries Sample.
