Esempio n. 1
0
        static public void Test()
        {
            int kcc = XKnownColorTable.colorTable.Length;

            for (int idx = 0; idx < kcc; idx++)
            {
                uint argb = XKnownColorTable.colorTable[idx];
                ColorResourceInfo info = GetColorInfo((XKnownColor)idx);
                if ((int)info.KnownColor == -1)
                {
                    kcc.GetType();
                }
                else
                {
                    if (argb != info.Argb)
                    {
                        kcc.GetType();
                    }
                }
            }

            for (int idx = 0; idx < colorInfos.Length; idx++)
            {
                ColorResourceInfo c2 = colorInfos[idx];
                if (c2.Argb != c2.Color.Rgb)
                {
                    c2.GetType();
                }
            }
        }
Esempio n. 2
0
 static ColorResourceInfo GetColorInfo(XKnownColor knownColor)
 {
     for (int idx = 0; idx < colorInfos.Length; idx++)
     {
         ColorResourceInfo colorInfo = colorInfos[idx];
         if (colorInfo.KnownColor == knownColor)
         {
             return(colorInfo);
         }
     }
     throw new InvalidEnumArgumentException("Enum is not an XKnownColor.");
 }
Esempio n. 3
0
        /// <summary>
        /// Converts a known color to a localized color name.
        /// </summary>
        public string ToColorName(XKnownColor knownColor)
        {
            ColorResourceInfo colorInfo = GetColorInfo(knownColor);

            // Currently German only
            if (_cultureInfo.TwoLetterISOLanguageName == "de")
            {
                return(colorInfo.NameDE);
            }

            return(colorInfo.Name);
        }