Beispiel #1
0
 /// <summary>
 /// Merges a CssStyleCollection into this one.
 /// </summary>
 /// <param name="src">The source collection.</param>
 /// <param name="overwrite">If true, will overwrite attributes of the same name.</param>
 public void Merge(CssStyleCollection src, bool overwrite)
 {
     foreach (string name in src.Keys)
     {
         if ((this[name] == null) || (overwrite))
         {
             Add(name, src[name]);
         }
     }
 }
Beispiel #2
0
 public static void Message(HtmlGenericControl hc, string message, CssStyleCollection styles, AttributeCollection attributes)
 {
     hc.InnerHtml = message;
     if (styles != null)
     {
         for (int i = 0; i < styles.Count; i++)
         {
         }
     }
 }
 public StyleBlockStyles AddStyles(CssStyleCollection styles)
 {
     if (styles != null)
     {
         foreach (string key in styles.Keys)
         {
             _styles.Add(key, styles[key]);
         }
     }
     return(this);
 }
Beispiel #4
0
        /// <summary>
        /// 将dictionary反序列化转换成特定类型的对象
        /// </summary>
        /// <param name="dictionary">要反序列化的数据</param>
        /// <param name="type">要反序列化的类型</param>
        /// <param name="serializer">JavaScriptSerializer对象</param>
        /// <returns>反序列化出的对象</returns>
        /// <remarks>将dictionary反序列化转换成特定类型的对象</remarks>
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, System.Web.Script.Serialization.JavaScriptSerializer serializer)
        {
            CssStyleCollection styles = (new AttributeCollection(null)).CssStyle;

            foreach (KeyValuePair <string, object> item in dictionary)
            {
                styles.Add(CastKey(item.Key), (string)item.Value);
            }

            return(styles);
        }
Beispiel #5
0
        internal static void RenderCssRule(CssTextWriter cssWriter, string selector,
                                           Style style, IUrlResolutionService urlResolver)
        {
            cssWriter.WriteBeginCssRule(selector);

            CssStyleCollection attrs = style.GetStyleAttributes(urlResolver);

            attrs.Render(cssWriter);

            cssWriter.WriteEndCssRule();
        }
Beispiel #6
0
 public StyleBlockStyles AddStyles(CssStyleCollection styles)
 {
     if (styles != null)
     {
         foreach (string str in styles.Keys)
         {
             this._styles.Add(str, styles[str]);
         }
     }
     return(this);
 }
Beispiel #7
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);
            Color shadowColor = this.ShadowColor;

            if (!shadowColor.IsEmpty)
            {
                string str  = ColorTranslator.ToHtml(shadowColor);
                string str2 = "progid:DXImageTransform.Microsoft.Shadow(color='" + str + "', Direction=135, Strength=3)";
                attributes.Add(HtmlTextWriterStyle.Filter, str2);
            }
        }
Beispiel #8
0
        public void FillStyleAttributes_NotCss()
        {
            CssStyleCollection css = GetCssCollection();
            TestTableStyle     ts  = new TestTableStyle();

            ts.CellPadding     = 1;
            ts.CellSpacing     = 1;
            ts.GridLines       = GridLines.Both;
            ts.HorizontalAlign = HorizontalAlign.Justify;
            ts.Fill(css, new TestResolutionService());
            Assert.AreEqual(0, css.Count, "Count");
        }
Beispiel #9
0
        public void FillStyleAttributes_Css_WithoutResolution()
        {
            CssStyleCollection css = GetCssCollection();
            TestTableStyle     ts  = new TestTableStyle();

            ts.BackImageUrl = "http://www.go-mono.com";
            ts.Fill(css, null);
            Assert.AreEqual(1, css.Count, "Count");
            Assert.AreEqual("http://www.go-mono.com", css["background-image"], "css[string]");
            Assert.AreEqual("http://www.go-mono.com", css[HtmlTextWriterStyle.BackgroundImage], "css[HtmlTextWriterStyle]");
            Assert.AreEqual("background-image:url(http://www.go-mono.com);", css.Value, "css.Value");
        }
    protected void PrepareCheckedDiv()
    {
        CheckedTextContainerStyle style = SpellChecker.GetCheckedTextContainerStyle();

        SCCheckedDiv.Attributes.Add("class", style.CssClass);
        CssStyleCollection styles = style.GetStyleAttributes(Page);

        foreach (string key in styles.Keys)
        {
            SCCheckedDiv.Style.Add(key, styles[key]);
        }
    }
Beispiel #11
0
        private string StyleCollectionToString(CssStyleCollection InColl)
        {
            IEnumerator   keys = InColl.Keys.GetEnumerator();
            StringBuilder sb   = new StringBuilder(1000);

            while (keys.MoveNext())
            {
                String key = (String)keys.Current;
                sb.Append(key + ":" + InColl[key] + ";");
            }
            return(sb.ToString( ));
        }
Beispiel #12
0
 /// <summary>
 /// Writes a collection of styles to the output stream.
 /// </summary>
 /// <param name="writer">The output stream to write to.</param>
 /// <param name="styles">The collection of styles.</param>
 public static void WriteStyles(HtmlTextWriter writer, CssStyleCollection styles)
 {
     if (styles.Count > 0)
     {
         writer.Write(" style=\"");
         foreach (string key in styles.Keys)
         {
             writer.WriteStyleAttribute(key, styles[key], true);
         }
         writer.Write("\"");
     }
 }
 public static void SetStyle(Control editor, Sitecore.Shell.Applications.ContentManager.Editor.Field field)
 {
     Assert.ArgumentNotNull(editor, "editor");
     Assert.ArgumentNotNull(field, "field");
     if (!string.IsNullOrEmpty(field.ItemField.Style))
     {
         CssStyleCollection property = Sitecore.Reflection.ReflectionUtil.GetProperty(editor, "Style") as CssStyleCollection;
         if (property != null)
         {
             UIUtil.ParseStyle(property, field.ItemField.Style);
         }
     }
 }
Beispiel #14
0
    public static void Visibility(this CssStyleCollection style, bool visibility)
    {
        style.Remove("visibility");

        if (visibility)
        {
            style.Add("visibility", "visible");
        }
        else
        {
            style.Add("visibility", "hidden");
        }
    }
Beispiel #15
0
 protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     if (BackColor.IsEmpty && ((_owner == null) || _owner.BackColor.IsEmpty))
     {
         attributes.Add(HtmlTextWriterStyle.BackgroundColor, "white");
     }
     attributes.Add(HtmlTextWriterStyle.Visibility, "hidden");
     attributes.Add(HtmlTextWriterStyle.Display, "none");
     attributes.Add(HtmlTextWriterStyle.Position, "absolute");
     attributes.Add(HtmlTextWriterStyle.Left, "0px");
     attributes.Add(HtmlTextWriterStyle.Top, "0px");
     base.FillStyleAttributes(attributes, urlResolver);
 }
        public void CssStyleCollection_BackgroundImage()
        {
            WebControl         c           = new WebControl(HtmlTextWriterTag.A);
            CssStyleCollection css         = c.Style;
            string             url         = "http://www.go-mono.com/space here?key1=val1&key2=val2";
            string             url_encoded = "http://www.go-mono.com/space%20here?key1=val1&key2=val2";

            css.Add(HtmlTextWriterStyle.BackgroundImage, url);

            Assert.AreEqual(url, css ["background-image"], "CssStyleCollection_BackgroundImage#1");
            Assert.AreEqual("background-image:url(" + url_encoded + ");", css.Value, "CssStyleCollection_BackgroundImage#3");
            Assert.AreEqual("background-image:url(" + url_encoded + ");", c.Attributes["style"], "CssStyleCollection_BackgroundImage#4");
        }
Beispiel #17
0
        public void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute("type", "text/css", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Style);

            foreach (StyleEntry entry in entries)
            {
                CssStyleCollection sts = entry.Style.GetStyleAttributes(entry.UrlResolver);
                writer.Write("\n" + entry.Selection + " {" + sts.Value + "}");
            }

            writer.RenderEndTag();
        }
Beispiel #18
0
        public static string GetCaseInsensitiveName(CssStyleCollection styles, string name)
        {
            string result = null;

            foreach (string currentName in styles.Keys)
            {
                if (Normaliser.StringCompare(currentName, name))
                {
                    result = currentName;
                }
            }

            return(result);
        }
Beispiel #19
0
 protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes(attributes, urlResolver);
     if (IsSet(HORZ_PADD))
     {
         attributes.Add(HtmlTextWriterStyle.PaddingLeft, HorizontalPadding.ToString());
         attributes.Add(HtmlTextWriterStyle.PaddingRight, HorizontalPadding.ToString());
     }
     if (IsSet(VERT_PADD))
     {
         attributes.Add(HtmlTextWriterStyle.PaddingTop, VerticalPadding.ToString());
         attributes.Add(HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString());
     }
 }
 protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes(attributes, urlResolver);
     if (CheckBit((int)TreeNodeStyles.HorizontalPadding))
     {
         attributes.Add(HtmlTextWriterStyle.PaddingLeft, HorizontalPadding.ToString());
         attributes.Add(HtmlTextWriterStyle.PaddingRight, HorizontalPadding.ToString());
     }
     if (CheckBit((int)TreeNodeStyles.VerticalPadding))
     {
         attributes.Add(HtmlTextWriterStyle.PaddingTop, VerticalPadding.ToString());
         attributes.Add(HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString());
     }
 }
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);
            string backImageUrl = this.BackImageUrl;

            if (backImageUrl.Length != 0)
            {
                if (urlResolver != null)
                {
                    backImageUrl = urlResolver.ResolveClientUrl(backImageUrl);
                }
                attributes.Add(HtmlTextWriterStyle.BackgroundImage, backImageUrl);
            }
        }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void imgbtnClearCalendar_Click(object sender, ImageClickEventArgs e)
    {
        CssStyleCollection pnlCalendarStyle = this.pnlCalendar.Style;
        string             DISPLAY          = pnlCalendarStyle["DISPLAY"];

        if (DISPLAY == "none")
        {
        }
        else
        {
            this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute");
        }
        txtDate.Text = "";
    }
Beispiel #23
0
 /// <summary>
 /// Merges this collection into a CssStyleCollection.
 /// </summary>
 /// <param name="dest">The destination collection.</param>
 /// <param name="overwrite">If true, will overwrite attributes of the same name.</param>
 public void MergeInto(CssStyleCollection dest, bool overwrite)
 {
     foreach (string name in this)
     {
         if (dest[name] == null)
         {
             dest.Add(name, this[name]);
         }
         else if (overwrite)
         {
             dest[name] = this[name];
         }
     }
 }
        public NamedCssStyleCollection CopyFrom(CssStyleCollection coll)
        {
            if (coll == null)
            {
                return(this);
            }

            CssStyleCollection collection = Collection;

            foreach (string key in coll.Keys)
            {
                collection.Add(key, coll [key]);
            }

            return(this);
        }
Beispiel #25
0
        private CssStyleCollection GetControlStyle(Control control, out bool isControlWidthEmpty)
        {
            CssStyleCollection controlStyle = null;

            isControlWidthEmpty = true;
            if (control is WebControl)
            {
                controlStyle        = ((WebControl)control).Style;
                isControlWidthEmpty = ((WebControl)control).Width.IsEmpty;
            }
            else if (control is HtmlControl)
            {
                controlStyle = ((HtmlControl)control).Style;
            }
            return(controlStyle);
        }
Beispiel #26
0
        /// <summary>
        /// Adds the default properties and attributes for a given control to a given attribute collection.
        /// </summary>
        /// <param name="control">The web control.</param>
        /// <param name="attributes">The collection of attributes.</param>
        /// <returns>The updated collection.</returns>
        public static AttributeCollection AddDefautAttributesToCollection(WebControl control, AttributeCollection attributes)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            CssStyleCollection styles = attributes.CssStyle;

            if (control.BackColor != Color.Empty)
            {
                styles["background-color"] = ColorTranslator.ToHtml(control.BackColor);
            }
            if (control.BorderColor != Color.Empty)
            {
                styles["border-color"] = ColorTranslator.ToHtml(control.BorderColor);
            }
            if (control.BorderStyle != BorderStyle.NotSet)
            {
                styles["border-style"] = control.BorderStyle.ToString().ToLowerInvariant();
            }
            if (!control.BorderWidth.IsEmpty)
            {
                styles["border-width"] = control.BorderWidth.ToString();
            }
            if (control.ForeColor != Color.Empty)
            {
                styles["color"] = ColorTranslator.ToHtml(control.ForeColor);
            }
            if (!control.Height.IsEmpty)
            {
                styles["height"] = control.Height.ToString();
            }
            if (!control.Width.IsEmpty)
            {
                styles["width"] = control.Width.ToString();
            }

            foreach (string key in control.Attributes.Keys)
            {
                if (!String.Equals(key, "style", StringComparison.InvariantCultureIgnoreCase))
                {
                    attributes.Add(key, control.Attributes[key]);
                }
            }
            return(attributes);
        }
Beispiel #27
0
    protected void PrepareCheckedDiv()
    {
        WebControl checkedDiv = RenderUtils.CreateDiv();

        checkedDiv.ID = "SCCheckedDiv";
        SCCheckedDivPlaceHolder.Controls.Add(checkedDiv);

        CheckedTextContainerStyle style = SpellChecker.GetCheckedTextContainerStyle();

        checkedDiv.Attributes.Add("class", style.CssClass);
        CssStyleCollection styles = style.GetStyleAttributes(Page);

        foreach (string key in styles.Keys)
        {
            checkedDiv.Style.Add(key, styles[key]);
        }
    }
Beispiel #28
0
        /// <summary>
        /// 将对象序列化成dictionary类型数据
        /// </summary>
        /// <param name="obj">要序列化的对象</param>
        /// <param name="serializer">JavaScriptSerializer对象</param>
        /// <returns>序列化出的dictionary类型数据</returns>
        /// <remarks>将对象序列化成dictionary类型数据</remarks>
        public override IDictionary <string, object> Serialize(object obj, System.Web.Script.Serialization.JavaScriptSerializer serializer)
        {
            CssStyleCollection style = obj as CssStyleCollection;

            if (style != null)
            {
                Dictionary <string, object> result = new Dictionary <string, object>();
                foreach (string key in style.Keys)
                {
                    result.Add(CastKey(key), style[key]);
                }

                return(result);
            }

            return(null);
        }
Beispiel #29
0
        private void ApplyStyleDefaults(Control control)
        {
            bool isControlWidthEmpty;
            CssStyleCollection controlStyle = GetControlStyle(control, out isControlWidthEmpty);

            if (controlStyle == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(controlStyle["width"]) && isControlWidthEmpty)
            {
                controlStyle["width"] = "100%";
            }
            if (string.IsNullOrEmpty(controlStyle["vertical-align"]))
            {
                controlStyle["vertical-align"] = "middle";
            }
        }
Beispiel #30
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);

            if (PaddingTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString());
            }
            if (PaddingLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString());
            }
            if (PaddingRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString());
            }
            if (PaddingBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString());
            }

            if (MarginTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString());
            }
            if (MarginLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString());
            }
            if (MarginRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString());
            }
            if (MarginBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString());
            }

            if (!String.IsNullOrEmpty(BackImageUrl))
            {
                attributes.Add(HtmlTextWriterStyle.BackgroundImage, String.Format("url({0})", urlResolver.ResolveClientUrl(BackImageUrl)));
            }
        }
 protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes(attributes, urlResolver);
     // here are the additional CSS styles
     attributes.Add("float", "right"); // move it to the right in the toolbar
     attributes.Add("margin-left", "2px"); // ensure some left padding
 }
Beispiel #32
0
		public CssStyleCollection GetStyleAttributes (IUrlResolutionService resolver)
		{
			CssStyleCollection col = new CssStyleCollection ();
			FillStyleAttributes (col, resolver);
			return col;
		}
Beispiel #33
0
		protected virtual void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
		{
			Color		color;
			BorderStyle	bs;
			Unit		u;

			if (CheckBit ((int) Styles.BackColor))
			{
				color = (Color)viewstate["BackColor"];
				if (!color.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
			}

			if (CheckBit ((int) Styles.BorderColor)) 
			{
				color = (Color)viewstate["BorderColor"];
				if (!color.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
			}

			bool have_width = false;
			if (CheckBit ((int) Styles.BorderWidth)) {
				u = (Unit) viewstate ["BorderWidth"];
				if (!u.IsEmpty) {
					if (u.Value > 0)
						have_width = true;
					attributes.Add (HtmlTextWriterStyle.BorderWidth, u.ToString ());
				}
			}

			if (CheckBit ((int) Styles.BorderStyle)) {
				bs = (BorderStyle) viewstate ["BorderStyle"];
				if (bs != BorderStyle.NotSet)
					attributes.Add (HtmlTextWriterStyle.BorderStyle, bs.ToString ());
				else if (have_width)
						attributes.Add (HtmlTextWriterStyle.BorderStyle, "solid");
			}
			else if (have_width) {
				attributes.Add (HtmlTextWriterStyle.BorderStyle, "solid");
			}

			if (CheckBit ((int) Styles.ForeColor)) 
			{
				color = (Color)viewstate["ForeColor"];
				if (!color.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
			}

			if (CheckBit ((int) Styles.Height)) 
			{
				u = (Unit)viewstate["Height"];
				if (!u.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.Height, u.ToString());
			}

			if (CheckBit ((int) Styles.Width)) 
			{
				u = (Unit)viewstate["Width"];
				if (!u.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.Width, u.ToString());
			}

			Font.FillStyleAttributes (attributes, AlwaysRenderTextDecoration);
		}
Beispiel #34
0
		public virtual void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, WebControl owner)
		{
#if NET_2_0
			if (RegisteredCssClass.Length > 0) {
				string cssclass = CssClass;
				if (!String.IsNullOrEmpty (cssclass))
					writer.AddAttribute (HtmlTextWriterAttribute.Class, cssclass + " " + RegisteredCssClass);
				else
					writer.AddAttribute (HtmlTextWriterAttribute.Class, RegisteredCssClass);
			}
			else 
#endif
			{
				string cssclass = CssClass;
				if (cssclass != null && cssclass.Length > 0)
					writer.AddAttribute (HtmlTextWriterAttribute.Class, cssclass);
#if NET_2_0
				CssStyleCollection col = new CssStyleCollection ();
				FillStyleAttributes (col, owner);
				foreach (string key in col.Keys) {
					writer.AddStyleAttribute (key, col [key]);
				}
#else
				WriteStyleAttributes (writer);
#endif
			}
		}
Beispiel #35
0
 //-------------------------------------------------------------------------------------------------------------
 public static void AddTDLine(CssStyleCollection css, int type, string strColor)
 {
     //css.Add("border-color", "red");
     switch (type)
     {
         case 1234:
             css.Add("border-left", "1px solid  " + strColor + " ");
             css.Add("border-top", "1px solid " + strColor + " ");
             css.Add("border-right", "1px solid " + strColor + " ");
             css.Add("border-bottom", "1px solid " + strColor + " ");
             break;
         case 123:
             css.Add("border-left", "1px solid " + strColor + "");
             css.Add("border-top", " 1px solid " + strColor + "");
             css.Add("border-right","1px solid " + strColor + "");
             break;
         case 234:
             css.Add("border-top", "1px solid  " + strColor + " ");
             css.Add("border-right", "1px solid  " + strColor + " ");
             css.Add("border-bottom", "1px solid  " + strColor + " ");
             break;
         case 124:
             css.Add("border-left", "1px solid  " + strColor + " ");
             css.Add("border-top", "1px solid  " + strColor + " ");
             css.Add("border-bottom", "1px solid " + strColor + "");
             break;
         case 134:
             css.Add("border-left", "1px solid  " + strColor + "");
             css.Add("border-right", "1px solid  " + strColor + "");
             css.Add("border-bottom", "1px solid  " + strColor + "");
             break;
         case 12:
             css.Add("border-left", "1px solid  " + strColor + "");
             css.Add("border-top", "1px solid  " + strColor + "");
             break;
         case 13:
             css.Add("border-left", "1px solid  " + strColor + "");
             css.Add("border-right", "1px solid  " + strColor + "");
             break;
         case 23:
             css.Add("border-top", "1px solid  " + strColor + "");
             css.Add("border-right", "1px solid  " + strColor + "");
             break;
         case 34:
             css.Add("border-right", "1px solid  " + strColor + "");
             css.Add("border-bottom", "1px solid " + strColor + " ");
             break;
         case 1:
             css.Add("border-left", "1px solid  " + strColor + "");
             break;
         case 2:
             css.Add("border-top", "1px solid  " + strColor + "");
             break;
         case 3:
             css.Add("border-right", "1px solid  " + strColor + "");
             break;
         case 4:
             css.Add("border-bottom", "1px solid  " + strColor + "");
             break;
         default:
             break;
     }
 }
		internal void FillStyleAttributes (CssStyleCollection attributes, bool alwaysRenderTextDecoration) {
			if (IsEmpty) {
				if(alwaysRenderTextDecoration)
					attributes.Add (HtmlTextWriterStyle.TextDecoration, "none");
				return;
			}

			string s;
			// Fonts are a bit weird
			s = String.Join (",", Names);
			if (s.Length > 0) {
				attributes.Add (HtmlTextWriterStyle.FontFamily, s);
			}

			if (_owner.CheckBit ((int) Style.Styles.FontBold)) {
				attributes.Add (HtmlTextWriterStyle.FontWeight, Bold ? "bold" : "normal");
			}

			if (_owner.CheckBit ((int) Style.Styles.FontItalic)) {
				attributes.Add (HtmlTextWriterStyle.FontStyle, Italic ? "italic" : "normal");
			}

			if (!Size.IsEmpty) {
				attributes.Add (HtmlTextWriterStyle.FontSize, Size.ToString ());
			}

			// These styles are munged into a attribute decoration
			s = string.Empty;
			bool hasTextDecoration = false;

			if (_owner.CheckBit ((int) Style.Styles.FontOverline)) {
				if (Overline)
					s += "overline ";
				hasTextDecoration = true;
			}

			if (_owner.CheckBit ((int) Style.Styles.FontStrikeout)) {
				if (Strikeout)
					s += "line-through ";
				hasTextDecoration = true;
			}

			if (_owner.CheckBit ((int) Style.Styles.FontUnderline)) {
				if (Underline)
					s += "underline ";
				hasTextDecoration = true;
			}

			s = (s.Length > 0) ? s.Trim () : (alwaysRenderTextDecoration || hasTextDecoration) ? "none" : "";
			if (s.Length > 0)
				attributes.Add (HtmlTextWriterStyle.TextDecoration, s);
		}
 public StyleBlockStyles AddStyles(CssStyleCollection styles) {
     if (styles != null) {
         foreach (string key in styles.Keys) {
             _styles.Add(key, styles[key]);
         }
     }
     return this;
 }
Beispiel #38
0
 //-------------------------------------------------------------------------------------------------------------
 public static void AddTDLine(CssStyleCollection css, int type)
 {
     switch (type)
     {
         case 1234:
             css.Add("border-left", "1px solid windowtext");
             css.Add("border-top", "1px solid windowtext");
             css.Add("border-right", "1px solid windowtext");
             css.Add("border-bottom", "1px solid windowtext");
             break;
         case 123:
             css.Add("border-left", "1px solid windowtext");
             css.Add("border-top", "1px solid windowtext");
             css.Add("border-right", "1px solid windowtext");
             break;
         case 234:
             css.Add("border-top", "1px solid windowtext");
             css.Add("border-right", "1px solid windowtext");
             css.Add("border-bottom", "1px solid windowtext");
             break;
         case 124:
             css.Add("border-left", "1px solid windowtext");
             css.Add("border-top", "1px solid windowtext");
             css.Add("border-bottom", "1px solid windowtext");
             break;
         case 134:
             css.Add("border-left", "1px solid windowtext");
             css.Add("border-right", "1px solid windowtext");
             css.Add("border-bottom", "1px solid windowtext");
             break;
         case 12:
             css.Add("border-left", "1px solid windowtext");
             css.Add("border-top", "1px solid windowtext");
             break;
         case 13:
             css.Add("border-left", "1px solid windowtext");
             css.Add("border-right", "1px solid windowtext");
             break;
         case 23:
             css.Add("border-top", "1px solid windowtext");
             css.Add("border-right", "1px solid windowtext");
             break;
         case 34:
             css.Add("border-right", "1px solid windowtext");
             css.Add("border-bottom", "1px solid windowtext");
             break;
         case 1:
             css.Add("border-left", "1px solid windowtext");
             break;
         case 2:
             css.Add("border-top", "1px solid windowtext");
             break;
         case 3:
             css.Add("border-right", "1px solid windowtext");
             break;
         case 4:
             css.Add("border-bottom", "1px solid windowtext");
             break;
         default:
             break;
     }
 }