--- title: "How to: Paint an Area with a Drawing" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "brushes [WPF], painting with drawings" - "painting [WPF], with drawings" - "drawings [WPF], painting with" ms.assetid: 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 and one or more objects. The following example uses a to paint an object with a drawing of two ellipses. ## Example [!code-xaml[drawingbrush_snip#DrawingBrushExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/drawingbrush_snip/CS/DrawingBrushExample.xaml#drawingbrushexamplewholepage)] [!code-csharp[drawingbrush_procedural_snip#DrawingBrushExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/drawingbrush_procedural_snip/CSharp/DrawingBrushExample.cs#drawingbrushexamplewholepage)] [!code-vb[drawingbrush_procedural_snip#DrawingBrushExampleWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/drawingbrush_procedural_snip/VisualBasic/DrawingBrushExample.vb#drawingbrushexamplewholepage)] The following illustration shows the example's output. ![Output from a DrawingBrush](./media/graphicsmm-drawingbrush-simple.png "graphicsmm_drawingbrush_simple") (The center of the shape is white for reasons described in [Control the Fill of a Composite Shape](how-to-control-the-fill-of-a-composite-shape.md).) By setting a object's and properties, you can create a repeating pattern. The following example paints an object with a pattern created from a drawing of two ellipses. [!code-xaml[drawingbrush_snip#TiledDrawingBrushExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/drawingbrush_snip/CS/TiledDrawingBrushExample.xaml#tileddrawingbrushexamplewholepage)] [!code-csharp[drawingbrush_procedural_snip#TiledDrawingBrushExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/drawingbrush_procedural_snip/CSharp/TiledDrawingBrushExample.cs#tileddrawingbrushexamplewholepage)] [!code-vb[drawingbrush_procedural_snip#TiledDrawingBrushExampleWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/drawingbrush_procedural_snip/VisualBasic/TiledDrawingBrushExample.vb#tileddrawingbrushexamplewholepage)] The following illustration shows the tiled output. ![Tiled output from a DrawingBrush](./media/graphicsmm-drawingbrush-tiled.png "graphicsmm_drawingbrush_tiled") For more information about drawing brushes, see [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md). For more information about objects, see the [Drawing Objects Overview](drawing-objects-overview.md).