mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-06 23:43:07 +02:00
* 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
31 lines
1.9 KiB
Markdown
31 lines
1.9 KiB
Markdown
---
|
|
title: "How to: Paint an Area with a Visual"
|
|
ms.date: "03/30/2017"
|
|
dev_langs:
|
|
- "csharp"
|
|
- "vb"
|
|
helpviewer_keywords:
|
|
- "painting [WPF]"
|
|
- "visuals [WPF], painting with"
|
|
- "brushes [WPF], painting with visuals"
|
|
ms.assetid: 35f92996-1d03-4542-acc4-3469dcf09492
|
|
---
|
|
# How to: Paint an Area with a Visual
|
|
This example shows how to use the <xref:System.Windows.Media.VisualBrush> class to paint an area with a <xref:System.Windows.Media.Visual>.
|
|
|
|
In the following example, several controls and a panel are used as the background of a rectangle.
|
|
|
|
## Example
|
|
[!code-xaml[BrushOverviewExamples_snip#GraphicsMMVisualBrushAsRectangleBackgroundExample](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushOverviewExamples_snip/XAML/VisualBrushExample.xaml#graphicsmmvisualbrushasrectanglebackgroundexample)]
|
|
|
|
[!code-csharp[BrushOverviewExamples_procedural_snip#GraphicsMMVisualBrushAsRectangleBackgroundExample1](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushOverviewExamples_procedural_snip/CSharp/VisualBrushExample.cs#graphicsmmvisualbrushasrectanglebackgroundexample1)]
|
|
[!code-vb[BrushOverviewExamples_procedural_snip#GraphicsMMVisualBrushAsRectangleBackgroundExample1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushOverviewExamples_procedural_snip/visualbasic/visualbrushexample.vb#graphicsmmvisualbrushasrectanglebackgroundexample1)]
|
|
|
|
For more information about <xref:System.Windows.Media.VisualBrush> and additional examples, see the [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md) overview.
|
|
|
|
This code example is part of a larger example provided for the <xref:System.Windows.Media.VisualBrush> class. For the complete sample, see the [VisualBrush Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/VisualBrush).
|
|
|
|
## See also
|
|
|
|
- [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md)
|