While the Properties window does show Gainsboro in the list, remember that
the values you select in the Properties window for web forms controls must
be able to be expressed (or better yet, rendered) to the client (browser) as
something the browser will understand. This is why a Web Forms control
might start out as: <ASP:Button>, but it winds up in the client as <INPUT
TYPE="Submit">. The same is true with property values. The only way to
specify a background color for an HTML control is via Cascading Style Sheets
and the STYLE attribute of the <INPUT> tag.
Now, here's the important part: in CSS, Gainsboro is a valid value for the
"background-color:" style sheet property, BUT there are 2 additional things
to consider...
1. Gainsboro is just a name that your video card must be able to present to
you. Not everyone has the same video card that you have and it is quite
possible that many people's systems will have no idea what Gainsboro is.
2. Even though on your system Gainsboro is a known color and even though
the Cascading Style Sheet language accepts Gainsboro as a value for the
"background-color:" style property, when you are working in .NET code, you
are not working in the Cascading Style Sheet language. You are working in a
different language that will be processed by a web server and the .NET
Framework, not a client browser and a video card. Because of this, you must
use the Color class. Microsoft certainly can't create constant values in
the color class for every color there is, so they created constants exposed
as properties for quite a few common colors. For all other colors, they
gave us the "FromARGB" method to "mix" up a color as we see fit.
To get the RGB of virtually any named color, a simple Google search on:
"gainsboro rgb" returns as the very first result, that 220, 220, 220 is the
RGB for Gainsboro.
-Scott