---
title: Brushes overview
description: Discover how to illustrate concepts by painting with simple, solid colors through gradients and patterns in Windows Presentation Foundation (WPF).
ms.date: "03/30/2017"
dev_langs:
- "csharp"
- "vb"
helpviewer_keywords:
- "brushes [WPF], about brushes"
ms.assetid: ecea1955-420b-45c6-bf43-c1404c072c41
---
# WPF Brushes Overview
Everything visible on your screen is visible because it was painted by a brush. For example, a brush is used to describe the background of a button, the foreground of text, and the fill of a shape. This topic introduces the concepts of painting with [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] brushes and provides examples. Brushes enable you to paint [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)] objects with anything from simple, solid colors to complex sets of patterns and images.
## Painting with a Brush
A "paints" an area with its output. Different brushes have different types of output. Some brushes paint an area with a solid color, others with a gradient, pattern, image, or drawing. The following illustration shows examples of each of the different types.

Brush examples
Most visual objects enable you to specify how they are painted. The following table lists some common objects and properties with which you can use a .
|Class|Brush properties|
|-----------|----------------------|
||, |
||, |
|||
|||
||, |
|||
The following sections describe the different types and provide an example of each.
## Paint with a Solid Color
A paints an area with a solid . There are a variety of ways to specify the of a : for example, you can specify its alpha, red, blue, and green channels or use one of the predefined color provided by the class.
The following example uses a to paint the of a . The following illustration shows the painted rectangle.

A Rectangle painted using a SolidColorBrush
[!code-csharp[BrushesIntroduction_snip#GraphicsMMSolidColorBrushExampleInline](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/BrushTypesExample.cs#graphicsmmsolidcolorbrushexampleinline)]
[!code-vb[BrushesIntroduction_snip#GraphicsMMSolidColorBrushExampleInline](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/brushtypesexample.vb#graphicsmmsolidcolorbrushexampleinline)]
[!code-xaml[BrushesIntroduction_snip#GraphicsMMSolidColorBrushExampleInline](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/BrushTypesExample.xaml#graphicsmmsolidcolorbrushexampleinline)]
For more information about the class, see [Painting with Solid Colors and Gradients Overview](painting-with-solid-colors-and-gradients-overview.md).
## Paint with a Linear Gradient
A paints an area with a linear gradient. A linear gradient blends two or more colors across a line, the gradient axis. You use objects to specify the colors in the gradient and their positions.
The following example uses a to paint the of a . The following illustration shows the painted rectangle.

A Rectangle painted using a LinearGradientBrush
[!code-csharp[BrushesIntroduction_snip#GraphicsMMLinearGradientBrushExampleInline](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/BrushTypesExample.cs#graphicsmmlineargradientbrushexampleinline)]
[!code-vb[BrushesIntroduction_snip#GraphicsMMLinearGradientBrushExampleInline](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/brushtypesexample.vb#graphicsmmlineargradientbrushexampleinline)]
[!code-xaml[BrushesIntroduction_snip#GraphicsMMLinearGradientBrushExampleInline](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/BrushTypesExample.xaml#graphicsmmlineargradientbrushexampleinline)]
For more information about the class, see [Painting with Solid Colors and Gradients Overview](painting-with-solid-colors-and-gradients-overview.md).
## Paint with a Radial Gradient
A paints an area with a radial gradient. A radial gradient blends two or more colors across a circle. As with the class, you use objects to specify the colors in the gradient and their positions.
The following example uses a to paint the of a . The following illustration shows the painted rectangle.

A Rectangle painted using a RadialGradientBrush
[!code-csharp[BrushesIntroduction_snip#GraphicsMMRadialGradientBrushExampleInline](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/BrushTypesExample.cs#graphicsmmradialgradientbrushexampleinline)]
[!code-vb[BrushesIntroduction_snip#GraphicsMMRadialGradientBrushExampleInline](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/brushtypesexample.vb#graphicsmmradialgradientbrushexampleinline)]
[!code-xaml[BrushesIntroduction_snip#GraphicsMMRadialGradientBrushExampleInline](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/BrushTypesExample.xaml#graphicsmmradialgradientbrushexampleinline)]
For more information about the class, see [Painting with Solid Colors and Gradients Overview](painting-with-solid-colors-and-gradients-overview.md).
## Paint with an Image
An paints an area with a .
The following example uses an to paint the of a . The following illustration shows the painted rectangle.

A Rectangle painted using a Image
[!code-csharp[BrushesIntroduction_snip#GraphicsMMImageBrushExampleInline](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/BrushTypesExample.cs#graphicsmmimagebrushexampleinline)]
[!code-vb[BrushesIntroduction_snip#GraphicsMMImageBrushExampleInline](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/brushtypesexample.vb#graphicsmmimagebrushexampleinline)]
[!code-xaml[BrushesIntroduction_snip#GraphicsMMImageBrushExampleInline](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/BrushTypesExample.xaml#graphicsmmimagebrushexampleinline)]
For more information about the class, see [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md).
## Paint with a Drawing
A paints an area with a . A can contain shapes, images, text, and media.
The following example uses a to paint the of a . The following illustration shows the painted rectangle.

A Rectangle painted using a DrawingBrush
[!code-csharp[BrushesIntroduction_snip#GraphicsMMDrawingBrushExampleInline](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/BrushTypesExample.cs#graphicsmmdrawingbrushexampleinline)]
[!code-vb[BrushesIntroduction_snip#GraphicsMMDrawingBrushExampleInline](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/brushtypesexample.vb#graphicsmmdrawingbrushexampleinline)]
[!code-xaml[BrushesIntroduction_snip#GraphicsMMDrawingBrushExampleInline](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/BrushTypesExample.xaml#graphicsmmdrawingbrushexampleinline)]
For more information about the class, see [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md).
## Paint with a Visual
A paints an area with a object. Examples of Visual objects include , , and . A also enables you to project content from one portion of your application into another area; it's very useful for creating reflection effects and magnifying portions of the screen.
The following example uses a to paint the of a . The following illustration shows the painted rectangle.

A Rectangle painted using a VisualBrush
[!code-csharp[BrushesIntroduction_snip#GraphicsMMVisualBrushExampleInline](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/BrushTypesExample.cs#graphicsmmvisualbrushexampleinline)]
[!code-vb[BrushesIntroduction_snip#GraphicsMMVisualBrushExampleInline](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/brushtypesexample.vb#graphicsmmvisualbrushexampleinline)]
[!code-xaml[BrushesIntroduction_snip#GraphicsMMVisualBrushExampleInline](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/BrushTypesExample.xaml#graphicsmmvisualbrushexampleinline)]
For more information about the class, see [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md).
## Paint using Predefined and System Brushes
For convenience, Windows Presentation Foundation (WPF) provides a set of predefined and system brushes that you can use to paint objects.
- For a list of available predefined brushes, see the class. For an example showing how to use a predefined brush, see [Paint an Area with a Solid Color](how-to-paint-an-area-with-a-solid-color.md).
- For a list of available system brushes, see the class. For an example, see [Paint an Area with a System Brush](how-to-paint-an-area-with-a-system-brush.md).
## Common Brush Features
objects provide an property that can be used to make a brush transparent or partially transparent. An value of 0 makes a brush completely transparent, while an value of 1 makes a brush completely opaque. The following example uses the property to make a 25 percent opaque.
[!code-xaml[BrushOverviewExamples_snip#OpacityExample1XAML](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushOverviewExamples_snip/XAML/OpacityExample.xaml#opacityexample1xaml)]
[!code-csharp[BrushOverviewExamples_snip#OpacityExample1CSharp](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushOverviewExamples_snip/CSharp/OpacityExample.cs#opacityexample1csharp)]
If the brush contains colors that are partially transparent, the opacity value of the color is combined through multiplication with the opacity value of the brush. For example, if a brush has an opacity value of 0.5 and a color used in the brush also has an opacity value of 0.5, the output color has an opacity value of 0.25.
> [!NOTE]
> It's more efficient to change the opacity value of a brush than it is to change the opacity of an entire element using its property.
You can rotate, scale, skew, and translate a brush's content by using its or properties. For more information, see [Brush Transformation Overview](brush-transformation-overview.md).
Because they are objects, objects can be animated. For more information, see [Animation Overview](animation-overview.md).
### Freezable Features
Because it inherits from the class, the class provides several special features: objects can be declared as [resources](/dotnet/desktop-wpf/fundamentals/xaml-resources-define), shared among multiple objects, and cloned. In addition, all the types except can be made read-only to improve performance and made thread-safe.
For more information about the different features provided by objects, see [Freezable Objects Overview](../advanced/freezable-objects-overview.md).
For more information on why objects cannot be frozen, see the type page.
## See also
-
-
- [Painting with Solid Colors and Gradients Overview](painting-with-solid-colors-and-gradients-overview.md)
- [Painting with Images, Drawings, and Visuals](painting-with-images-drawings-and-visuals.md)
- [Freezable Objects Overview](../advanced/freezable-objects-overview.md)
- [Brushes Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/Brushes)
- [ImageBrush Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/ImageBrush)
- [VisualBrush Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/VisualBrush)
- [How-to Topics](brushes-how-to-topics.md)
- [Other Performance Recommendations](../advanced/optimizing-performance-other-recommendations.md)