示例#1
0
            /// <summary>
            ///     Ints the color of to knowncolor name.
            /// </summary>
            /// <param name="colorValue">The color value.</param>
            /// <returns>The known color, if not found returns "Unknown"</returns>
            public static string IntToKnownColorName(int colorValue)
            {
                if (KnownColorDictionary == null)
                {
                    KnownColorDictionary = GetKnownColorDictionary();
                }

                string colorName = "Unknown";

                KnownColorDictionary.TryGetValue(colorValue, out colorName);
                return(colorName);
            }
示例#2
0
            /// <summary>
            ///     Ints the color of to known.
            /// </summary>
            /// <param name="colorValue">The color value.</param>
            /// <returns>The known color, if not found returns Transparant</returns>
            public static KnownColor IntToKnownColor(int colorValue)
            {
                if (KnownColorDictionary == null)
                {
                    KnownColorDictionary = GetKnownColorDictionary();
                }

                if (KnownColorDictionary.ContainsKey(colorValue))
                {
                    return
                        ((KnownColor)
                         Enum.Parse(typeof(KnownColor), KnownColorDictionary[colorValue]));
                }
                return(KnownColor.Transparent);
            }