Programming WPF, 2nd Edition by Chris Sells & Ian Griffiths

Programming WPF, 2nd Edition by Chris Sells & Ian Griffiths

Author:Chris Sells & Ian Griffiths [Chris Sells]
Language: eng
Format: epub
Tags: COMPUTERS / Programming Languages / General
ISBN: 9780596158590
Publisher: O'Reilly Media
Published: 2008-12-16T16:00:00+00:00


SolidColorBrush

SolidColorBrush is the simplest brush. It uses one color across the whole area being painted. It has just one property, Color. Note that this color is allowed to use transparency, despite what the word Solid suggests.

We have already been using the SolidColorBrush extensively even though we have not yet referred to it by name. This is because WPF creates this kind of brush if you specify the name of a color in markup—if you work mostly with XAML, you very rarely need to specify that you require a SolidColorBrush, because you'll get one by default. (The only reason you would normally specify it in full is if you want to use data binding with the brush's properties.) Consider this example:

<Rectangle Fill="Yellow" Width="100" Height="20" />

The XAML compiler will recognize Yellow as one of the standard named colors from the Colors class, and will supply a suitable SolidColorBrush. (See Appendix A for more information on how XAML maps from strings to property values.) It does not need to create the brush, because there is a Brushes class, providing a set of brushes for each of the named colors in Colors.

You will also be provided with a SolidColorBrush if your markup uses a numeric color value. Example 13-38 shows various examples of numeric colors. All but the last two begin with a # symbol and contain hexadecimal digits. A three-digit number is taken to be one digit each of red, green, and blue. A four-digit number is interpreted as alpha, red, green, and blue. These are compact formats providing just 4 bits per channel. Six- or eight-digit numbers allow 8 bits per channel for RGB or ARGB, respectively. To exploit the full accuracy of scRGB, you provide a string that starts with "sc#" followed by a space, and then four comma-separated decimal numbers representing the A, R, G, and B values. Finally, if the string starts with ContextColor, you can define a color that refers to a specific International Color Consortium (ICC) or Image Color Manager (ICM) color profile file.

Example 13-38. Numeric color values

<Rectangle Fill="#8f8" Width="100" Height="20" /> <Rectangle Fill="#1168ff" Width="50" Height="40" /> <Rectangle Fill="#8ff0" Width="130" Height="10" /> <Rectangle Fill="#72ff8890" Width="70" Height="30" /> <Rectangle Fill="sc# 0.8,0.1442,0.429,0.94" Width="10" Height="20" /> <Rectangle Fill="ContextColor file://C:/Windows/System32/spool/drivers/color/sRGB%20Color%20Space%20Profile.icm 1.0,0.0,1.0,0.0" Width="10" Height="20" />



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(56030)
What's Done in Darkness by Kayla Perrin(26593)
The Fifty Shades Trilogy & Grey by E L James(19079)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19058)
Shot Through the Heart by Mercy Celeste(18936)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17112)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16994)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16878)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16825)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16447)
The Subtle Art of Not Giving a F*ck by Mark Manson(14353)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14140)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13645)
Scorched Earth by Nick Kyme(12771)
Drei Generationen auf dem Jakobsweg by Stein Pia(10965)
Suna by Ziefle Pia(10889)
Scythe by Neal Shusterman(10338)
The Ultimate Python Exercise Book: 700 Practical Exercises for Beginners with Quiz Questions by Copy(9537)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9522)
D:\Jan\FTP\HOL\Work\Alien Breed - Tower Assault CD32 Alien Breed II - The Horror Continues Manual 1.jpg by PDFCreator(9510)