Ejemplo n.º 1
0
        public string ToCss()
        {
            string text = TextDecoration.ToString().ToLower();

            if (TextDecoration == TextDecoration.LineThrough)
            {
                text = "line-through";
            }

            return(CssStyleBroker.WrapCssClassName(this, String.Format("text-decoration: {0}", text)));
        }
Ejemplo n.º 2
0
        public string ToCss()
        {
            StringBuilder output = new StringBuilder(40);

            if (TextDecoration != TextDecoration.None)
            {
                string text = TextDecoration.ToString().ToLower();
                if (TextDecoration == TextDecoration.LineThrough)
                {
                    text = "line-through";
                }

                output.AppendLine(string.Format("text-decoration: {0};", text));
            }

            if (FontWeight != null && FontWeight.HasValue)
            {
                output.AppendLine(string.Format("font-weight: {0};", FontWeight.Value.Weight));
            }

            if (FontStyle != FontStyle.Normal)
            {
                output.AppendLine(string.Format("font-style: {0};", FontStyle.ToString().ToLower()));
            }

            if (BackgroundColor.HasValue)
            {
                output.AppendLine(string.Format("background: rgba({0:d},{1:d},{2:d},{3:f});", BackgroundColor.Value.R,
                                                BackgroundColor.Value.G,
                                                BackgroundColor.Value.B,
                                                BackgroundColor.Value.A / 255f));
            }

            if (ForegroundColor.HasValue)
            {
                output.AppendLine(string.Format("color: rgba({0:d},{1:d},{2:d},{3:f}) !important;", ForegroundColor.Value.R,
                                                ForegroundColor.Value.G,
                                                ForegroundColor.Value.B,
                                                ForegroundColor.Value.A / 255f));
            }

            return(this.WrapCssClassName(output.ToString()));
        }
Ejemplo n.º 3
0
        public string ToCss()
        {
            StringBuilder output = new StringBuilder(40);

            if (TextDecoration != TextDecoration.None)
            {
                string text = TextDecoration.ToString().ToLower();
                if (TextDecoration == TextDecoration.LineThrough)
                {
                    text = "line-through";
                }

                output.AppendLine(string.Format("text-decoration: {0};", text));
            }

            if (FontWeight != null && FontWeight.HasValue)
            {
                output.AppendLine(string.Format("font-weight: {0};", FontWeight.Value.Weight));
            }

            if (FontStyle != FontStyle.Normal)
            {
                output.AppendLine(string.Format("font-style: {0};", FontStyle.ToString().ToLower()));
            }

            if (BackgroundColor != null)
            {
                output.AppendLine(string.Format("background: #{0:X2}{1:X2}{2:X2};", BackgroundColor.Color.R,
                                                BackgroundColor.Color.G,
                                                BackgroundColor.Color.B));
            }

            if (ForegroundColor != null)
            {
                output.AppendLine(string.Format("color: #{0:X2}{1:X2}{2:X2} !important;", ForegroundColor.Color.R,
                                                ForegroundColor.Color.G,
                                                ForegroundColor.Color.B));
            }

            return(CssStyleBroker.WrapCssClassName(this, output.ToString()));
        }