O'Reilly logo

WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix G. Brushes

This appendix summarizes brushes. A Brush defines the colors used to fill an area such as a Rectangle or Ellipse. Brushes also define the colors used by many controls' Foreground and Background properties.

The following section briefly describes each of the types of Brushes available. The sections that follow describe each of the Brush types in greater detail.

Brush Classes

Table G-1 summarizes the Brush classes.

Table G.1. Classes of Brush

Brush Class

Purpose

DrawingBrush

Fills areas with a drawing.

ImageBrush

Fills areas with one or more copies of an image.

LinearGradientBrush

Fills areas with a color gradient that shades between two or more colors in a linear direction.

RadialGradientBrush

Fills areas with a color gradient that shades between two or more colors radially.

SolidColorBrush

Fills areas with a solid color.

VisualBrush

Fills areas with a visual. (Loosely speaking, a visual is an object that provides rendering support for WPF. It's basically something that can draw itself such as a control.)

The Brushes example program shown in Figure G-1 demonstrates these kinds of brushes. The SolidColorBrush fills its Ellipse with dark gray, the LinearGradientBrush shades from white at the top to black at the bottom, and the RadialGradientBrush shades from white at the middle to black at the edges.

Figure G-1

Figure G.1. Figure G-1

DrawingBrush

A DrawingBrush fills areas with a Drawing object. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required