* 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, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|
| How to: Create a GeometryDrawing | 03/30/2017 |
|
11d3c096-91ba-4d41-9bba-aeac0db70f97 |
How to: Create a GeometryDrawing
This example shows how to create and display a xref:System.Windows.Media.GeometryDrawing. A xref:System.Windows.Media.GeometryDrawing enables you to create shape with a fill and an outline by associating a xref:System.Windows.Media.Pen and a xref:System.Windows.Media.Brush with a xref:System.Windows.Media.Geometry. The xref:System.Windows.Media.GeometryDrawing.Geometry%2A describes the shape's structure, the xref:System.Windows.Media.GeometryDrawing.Brush%2A describes the shape's fill, and the xref:System.Windows.Media.GeometryDrawing.Pen%2A describes the shape's outline.
Example
The following example uses a xref:System.Windows.Media.GeometryDrawing to render a shape. The shape is described by a xref:System.Windows.Media.GeometryGroup and two xref:System.Windows.Media.EllipseGeometry objects. The shape's interior is painted with a xref:System.Windows.Media.LinearGradientBrush and its outline is drawn with a xref:System.Windows.Media.Brushes.Black%2A xref:System.Windows.Media.Pen. The xref:System.Windows.Media.GeometryDrawing is displayed using an xref:System.Windows.Media.ImageDrawing and an xref:System.Windows.Controls.Image element.
[!code-csharpDrawingMiscSnippets_snip#GeometryDrawingExampleWholePage] [!code-xamlDrawingMiscSnippets_snip#GeometryDrawingExampleWholePage]
The following illustration shows the resulting xref:System.Windows.Media.GeometryDrawing.
To create more complex drawings, you can combine multiple drawing objects into a single composite drawing using a xref:System.Windows.Media.DrawingGroup.
