Click here to Skip to main content
15,888,322 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to go to the next color? Pin
DaveyM6930-Jul-08 2:45
professionalDaveyM6930-Jul-08 2:45 
GeneralRe: How to go to the next color? Pin
ElSpinos30-Jul-08 2:58
ElSpinos30-Jul-08 2:58 
GeneralRe: How to go to the next color? Pin
bouli30-Jul-08 4:40
bouli30-Jul-08 4:40 
AnswerRe: How to go to the next color? Pin
Jason Henderson30-Jul-08 4:25
Jason Henderson30-Jul-08 4:25 
GeneralRe: How to go to the next color? Pin
bouli30-Jul-08 23:06
bouli30-Jul-08 23:06 
GeneralRe: How to go to the next color? Pin
Jason Henderson31-Jul-08 3:43
Jason Henderson31-Jul-08 3:43 
GeneralRe: How to go to the next color? Pin
bouli1-Aug-08 3:13
bouli1-Aug-08 3:13 
GeneralRe: How to go to the next color? Pin
DaveyM691-Aug-08 3:42
professionalDaveyM691-Aug-08 3:42 
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)

AnswerRe: How to go to the next color? Pin
Frank Horn30-Jul-08 4:44
Frank Horn30-Jul-08 4:44 
GeneralRe: How to go to the next color? Pin
bouli30-Jul-08 23:07
bouli30-Jul-08 23:07 
QuestionProperty Attributes Pin
cecildt30-Jul-08 0:49
cecildt30-Jul-08 0:49 
AnswerRe: Property Attributes Pin
Tuwing.Sabado30-Jul-08 3:36
Tuwing.Sabado30-Jul-08 3:36 
GeneralRe: Property Attributes Pin
cecildt30-Jul-08 3:52
cecildt30-Jul-08 3:52 
GeneralRe: Property Attributes Pin
Tuwing.Sabado30-Jul-08 4:10
Tuwing.Sabado30-Jul-08 4:10 
AnswerRe: Property Attributes Pin
Wendelius30-Jul-08 8:46
mentorWendelius30-Jul-08 8:46 
GeneralRe: Property Attributes Pin
cecildt30-Jul-08 10:19
cecildt30-Jul-08 10:19 
GeneralRe: Property Attributes Pin
Wendelius30-Jul-08 10:23
mentorWendelius30-Jul-08 10:23 
QuestionDirect3D Wrapper - C# or Managed C++ ? Pin
Kel_30-Jul-08 0:44
Kel_30-Jul-08 0:44 
AnswerRe: Direct3D Wrapper - C# or Managed C++ ? Pin
Simon P Stevens30-Jul-08 0:53
Simon P Stevens30-Jul-08 0:53 
AnswerRe: Direct3D Wrapper - C# or Managed C++ ? Pin
User 665830-Jul-08 1:11
User 665830-Jul-08 1:11 
AnswerRe: Direct3D Wrapper - C# or Managed C++ ? Pin
Kel_30-Jul-08 9:59
Kel_30-Jul-08 9:59 
AnswerRe: Direct3D Wrapper - C# or Managed C++ ? Pin
Mark Churchill30-Jul-08 17:05
Mark Churchill30-Jul-08 17:05 
AnswerRe: Direct3D Wrapper - C# or Managed C++ ? Pin
Kel_1-Aug-08 3:48
Kel_1-Aug-08 3:48 
Questioncrystal reports with dynamic column display Pin
sarilee30-Jul-08 0:33
sarilee30-Jul-08 0:33 
Questionversion Pin
arkiboys30-Jul-08 0:20
arkiboys30-Jul-08 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.