Applying a SolidColorBrush

The System.Windows.Media.SolidColorBrush object enables filling an object with a single color. Generally the color is applied to the Fill property of geometric shapes and to the Background or Foreground properties in UI controls. The following code demonstrates how to apply a SolidColorBrush:

image

The Color property receives a value of type System.Windows.Media.Color. Colors are exposed by the System.Windows.Media.Colors class as shared properties. The result of this color brush is shown in Figure 33.1.

Figure 33.1 Applying a SolidColorBrush.

Applying a color at runtime in Visual Basic code is also a simple task. The following ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.