If you want the same sort as the Web tab why not create your own dictionary and enum. The colors will be stored in the dictionary in whatever order you want and because an enum member is really an int you can use that to get the actual Color from the dictionary.
public enum WebColors // To be completed!
{
Transparent, Black, White,
DimGray, Gray, DarkGray, Silver, LightGray, Gainsboro, WhiteSmoke,
Maroon, DarkRed, Red
}
public class WebColorDictionary : Dictionary<int, Color>
{
public WebColorDictionary()
{
Initialize();
}
private void Initialize() // To be completed!
{
this.Add(0, Color.Transparent);
this.Add(1, Color.Black);
this.Add(2, Color.White);
this.Add(3, Color.DimGray);
this.Add(4, Color.Gray);
this.Add(5, Color.DarkGray);
this.Add(6, Color.Silver);
this.Add(7, Color.LightGray);
this.Add(8, Color.Gainsboro);
this.Add(9, Color.WhiteSmoke);
this.Add(10, Color.Maroon);
this.Add(11, Color.DarkRed);
this.Add(12, Color.Red);
}
}
You can now do something like this:
foreach (string s in Enum.GetNames(typeof(WebColors)))
Console.WriteLine(s);
and:
WebColorDictionary myColors = new WebColorDictionary();
BackColor = myColors[(int)WebColors.Silver];
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)