GetName() public static méthode

public static GetName ( KnownColor kc ) : string
kc KnownColor
Résultat string
Exemple #1
0
        internal static Color FromArgbNamed(int alpha, int red, int green, int blue, string name, KnownColor knownColor)
        {
            Color color = FromArgb(alpha, red, green, blue);

            color.state      = (short)(ColorType.Known | ColorType.Named);
            color.name       = KnownColors.GetName(knownColor);
            color.knownColor = (short)knownColor;
            return(color);
        }
Exemple #2
0
        public static string ToHtml(Color_ c)
        {
            if (c.IsEmpty)
            {
                return(String.Empty);
            }

            if (c.IsSystemColor)
            {
                KnownColor kc = c.ToKnownColor();
                switch (kc)
                {
                case KnownColor.ActiveBorder:
                case KnownColor.ActiveCaption:
                case KnownColor.AppWorkspace:
                case KnownColor.GrayText:
                case KnownColor.Highlight:
                case KnownColor.HighlightText:
                case KnownColor.InactiveBorder:
                case KnownColor.InactiveCaption:
                case KnownColor.InactiveCaptionText:
                case KnownColor.InfoText:
                case KnownColor.Menu:
                case KnownColor.MenuText:
                case KnownColor.ScrollBar:
                case KnownColor.Window:
                case KnownColor.WindowFrame:
                case KnownColor.WindowText:
                    return(KnownColors.GetName(kc).ToLower());

                case KnownColor.ActiveCaptionText:
                    return("captiontext");

                case KnownColor.Control:
                    return("buttonface");

                case KnownColor.ControlDark:
                    return("buttonshadow");

                case KnownColor.ControlDarkDark:
                    return("threeddarkshadow");

                case KnownColor.ControlLight:
                    return("buttonface");

                case KnownColor.ControlLightLight:
                    return("buttonhighlight");

                case KnownColor.ControlText:
                    return("buttontext");

                case KnownColor.Desktop:
                    return("background");

                case KnownColor.HotTrack:
                    return("highlight");

                case KnownColor.Info:
                    return("infobackground");

                default:
                    return(String.Empty);
                }
            }

            if (c.IsNamedColor)
            {
                if (c == Color_.LightGray)
                {
                    return("LightGrey");
                }
                else
                {
                    return(c.Name);
                }
            }

            return(FormatHtml(c.R, c.G, c.B));
        }