Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

19. WPF Graphics > The Color Structure

The Color Structure

In .NET, colors are represented by the Color structure. The Framework also defines two classes that provide access to pre-defined color structures. The System.Windows.Media.Colors class contains a set of named colors based on the common “Internet-safe” color set. The System.Windows.SystemColors class defines static properties such as ControlColor and ControlBrush (we’ll talk about brushes in a minutes) that represent the Windows color scheme set by the user.

image

Put on Your Thinking Hat

image

Can you write the code to set a Color named MyColor to each of the following colors?

A pure blue at 50% transparency

A purple with R=127, G=68 and B=182, fully opaque

The color named CadetBlue in the Colors class, which has R=95, G=158, and B=160, with 75% transparency


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint