* 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
3.0 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Paint an Area with a Drawing | 03/30/2017 |
|
|
c10dc4b1-09b1-41e8-ad14-456b5fb377df |
How to: Paint an Area with a Drawing
This example shows how to paint an area with a drawing. To paint an area with a drawing, you use a xref:System.Windows.Media.DrawingBrush and one or more xref:System.Windows.Media.Drawing objects. The following example uses a xref:System.Windows.Media.DrawingBrush to paint an object with a drawing of two ellipses.
Example
[!code-xamldrawingbrush_snip#DrawingBrushExampleWholePage]
[!code-csharpdrawingbrush_procedural_snip#DrawingBrushExampleWholePage] [!code-vbdrawingbrush_procedural_snip#DrawingBrushExampleWholePage]
The following illustration shows the example's output.
(The center of the shape is white for reasons described in Control the Fill of a Composite Shape.)
By setting a xref:System.Windows.Media.DrawingBrush object's xref:System.Windows.Media.TileBrush.Viewport%2A and xref:System.Windows.Media.TileBrush.TileMode%2A properties, you can create a repeating pattern. The following example paints an object with a pattern created from a drawing of two ellipses.
[!code-xamldrawingbrush_snip#TiledDrawingBrushExampleWholePage]
[!code-csharpdrawingbrush_procedural_snip#TiledDrawingBrushExampleWholePage] [!code-vbdrawingbrush_procedural_snip#TiledDrawingBrushExampleWholePage]
The following illustration shows the tiled xref:System.Windows.Media.DrawingBrush output.
For more information about drawing brushes, see Painting with Images, Drawings, and Visuals. For more information about xref:System.Windows.Media.Drawing objects, see the Drawing Objects Overview.

