System.Drawing.Color.What?
I have started using the TallPDF.NET component to create a dynamic PDF report and bumped into a little problem when I had to specify the background colors for various parts of my report. I could use the VS.NET intellisense to give me a list of all the avalible colors, but who knows what Chartreuse looks like?
So I put together a simple Windows Form that has a comboBox and a panel, and added some code to add all the colors to the comboBox, and on SelectedIndexChanged modify the background color of the panel.
To add the colors to the comboBox:
foreach (string colourName in Enum.GetNames(typeof(KnownColor)))
{
comboBox1.Items.Add(colourName);
}
And then add an SelectedIndexChanged event to the comboBox with the following code:
string cName = (comboBox1.SelectedItem as string);
Color newColour = Color.FromName(cName);
panel1.BackColor = newColour;