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

System Color Viewer

By , 30 Jan 2013
 

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)

About the Author

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionAn extended version of your "System Color Viewer" …memberMartin08154 Feb '13 - 1:33 
AnswerRe: An extended version of your "System Color Viewer" …memberChen.shaohua9 Feb '13 - 20:05 

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

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