Smrf.NodeXL.ExcelTemplate.ColorConverter2.ColorConverter2 C# (CSharp) Method

ColorConverter2() public method

Initializes a new instance of the ColorConverter2 class.
public ColorConverter2 ( ) : System
return System
    public ColorConverter2()
    {
        m_oColorConverter = new System.Drawing.ColorConverter();

        // System.Drawing.ColorConverter.ConvertToInvariantString() converts a
        // common Color, such as (255,0,0), to its common name, such as "Red",
        // only if the Color was originally created from a name.  Otherwise, it
        // converts the color to the string "255, 0, 0".  To make colors more
        // readable, this class explicitly converts common colors to their
        // names using a dictionary lookup.

        m_oCommonColorNames = new Dictionary<Color, String>();

        m_oCommonColorNames.Add(Color.FromArgb(  0,   0,   0), "Black");
        m_oCommonColorNames.Add(Color.FromArgb(255, 255, 255), "White");

        m_oCommonColorNames.Add(Color.FromArgb(  0,   0, 255), "Blue");
        m_oCommonColorNames.Add(Color.FromArgb(  0, 255,   0), "Lime");
        m_oCommonColorNames.Add(Color.FromArgb(255,   0,   0), "Red");

        m_oCommonColorNames.Add(Color.FromArgb(0,   255, 255), "Cyan");
        m_oCommonColorNames.Add(Color.FromArgb(255, 255,   0), "Yellow");
        m_oCommonColorNames.Add(Color.FromArgb(255,   0, 255), "Magenta");

        m_oCommonColorNames.Add(Color.FromArgb(255, 165,   0), "Orange");
        m_oCommonColorNames.Add(Color.FromArgb(0,   128,   0), "Green");

        AssertValid();
    }