Prev | Current Page 353 | Next

Matthew MacDonald

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

And because you can apply different
colors to different parts of a control, you can use transparent colors to create a control
that is partly transparent??”for example, a semitransparent background with completely
opaque text.
Figure 7-1 shows an example that has several semitransparent layers:
??? The window has an opaque white background.
??? The top-level StackPanel that contains all the elements has an ImageBrush that applies
a picture. The Opacity of this brush is reduced to lighten it, allowing the white window
background to show through.
CHAPTER 7 n CLASSIC CONTROLS 186
??? The first button uses a semitransparent red background color. The image shows
through in the button background, but the text is opaque.
??? The label (under the first button) is used as is. By default, all labels have a completely
transparent background color.
??? The text box uses opaque text and an opaque border but a semitransparent background
color.
??? Another StackPanel under the text box uses a TileBrush to create a pattern of happy
faces. The TileBrush has a reduced Opacity, so the other background shows through.
For example, you can see the sun at the bottom-right corner of the form.
??? In the second StackPanel is a TextBlock with a completely transparent background and
semitransparent white text.


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