Prev | Current Page 351 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

You can use one of two formats??”either
#rrggbb or #aarrggbb (the difference being that the latter includes the alpha value). You
need only two digits to supply the A, R, G, and B values because they??™re all in hexadecimal
notation. Here??™s an example that creates the same color as in the previous code snippets
using #aarrggbb notation:

Here the alpha value is FF (255), the red value is FF (255), and the green and blue values
are 0.
CHAPTER 7 n CLASSIC CONTROLS 185
nNote Brushes support automatic change notification. In other words, if you attach a brush to a control
and change the brush, the control updates itself accordingly. This works because brushes derive from the
System.Windows.Freezable class. The name stems from the fact that all freezable objects have two states??”
a readable state and a read-only (or ???frozen???) state.
The Background and Foreground properties aren??™t the only details you can set with a
brush. You can also paint a border around controls (and some other elements, such as the
Border element) using the BorderBrush and BorderThickness properties. BorderBrush takes
a brush of your choosing, and BorderThickness takes the width of the border in deviceindependent
units. You need to set both properties before you??™ll see the border.


Pages:
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363