Click here to Skip to main content
Click here to Skip to main content

System Color Viewer

, 30 Jan 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
View each color in System.Drawing.Color

Introduction

When I make GDI+ projects, I need color information, and I used the 'DevColor' extension before, it is a very good one but it doesn't work on my machine now (VS2012). So today, I created this viewer for a simple way to access color information in the System.Drawing.Color class.

Using the Code

Here is the code:

private void updateView()
{
    listView1.Items.Clear();

    object obj= Color.AliceBlue ;

    PropertyInfo[] ps = typeof(Color).GetProperties();

    for (int i = 0; i < ps.Length; i++)
    {
        if (ps[i].DeclaringType == typeof(Color)) 
        {
            obj = ps[i].GetValue(new Color(), null);
            if (obj is Color)
            {
                listView1.Items.Add(new ListViewItem(new string[] { 
                    ps[i].Name,
                    ((Color)obj).ToArgb().ToString()
                }));
            }
        }
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Chen.shaohua
Software Developer CONSPEC CONTROLS
China China
Happy to meet you!

Comments and Discussions

 
QuestionAn extended version of your "System Color Viewer" … PinmemberMartin08154-Feb-13 2:33 
AnswerRe: An extended version of your "System Color Viewer" … PinmemberChen.shaohua9-Feb-13 21:05 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411019.1 | Last Updated 30 Jan 2013
Article Copyright 2013 by Chen.shaohua
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid