views:

152

answers:

1

In Visual Studio Design View, the selection of Form Colors in the Properties Pane are selectable from the "Custom", "Web", and "System" tabs. Of course, the color number can be used, too.

When the "System" Tab is selected, the colors in the list depend on what type of Theme the Computer User has set on the PC.

I'd like to stick with this, but I need to know how to "read in" the colors. I have controls that I create "on-the-fly" or often need to change a color back after getting the person's attention using a blink/flicker technique.

How do I get the list of System Theme colors?

Most forms have a BackColor that defaults to "Control", which looks like a very light gray under Windows 7, running the default Windows 7 Theme.

I've managed to grab a color by physically reading the ARGB value in code, but I'd rather have a way to access the colors by their Theme Name, if that can be done.

public Form1()
{
  Color cControl = this.BackColor;
  Console.WriteLine(cControl.Name); // there is not always a name!
}

Does anyone know what I'm talking about?

+2  A: 

From the sounds of your question, you're looking for:

System.Drawing.SystemColors which will give you a full list of the system colors by name.

CnTwo
That works! Color cControl = SystemColors.Control;Easier than it looks once you know what to call it! :)
jp2code