protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
            {
                base.FillStyleAttributes(attributes, urlResolver);

                attributes.Add("background-color", "transparent");
                attributes.Add("cursor", "text");
                attributes.Add("width", "13px");
            }
Esempio n. 2
0
 protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes(attributes, urlResolver);
     foreach (string key in Style.Keys)
     {
         attributes[key] = Style[key];
     }
 }
Esempio n. 3
0
            protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver)
            {
                if (!string.IsNullOrEmpty(Position))
                {
                    attributes[HtmlTextWriterStyle.Position] = Position;
                }
                if (!string.IsNullOrEmpty(Visibility))
                {
                    attributes[HtmlTextWriterStyle.Visibility] = Visibility;
                }
                if (!Left.IsEmpty)
                {
                    attributes[HtmlTextWriterStyle.Left] = Left.ToString();
                }
                if (!Top.IsEmpty)
                {
                    attributes[HtmlTextWriterStyle.Top] = Top.ToString();
                }

                if (!string.IsNullOrEmpty(Margin))
                {
                    attributes[HtmlTextWriterStyle.Margin] = Margin.ToString();
                }
                if (!string.IsNullOrEmpty(Padding))
                {
                    attributes[HtmlTextWriterStyle.Padding] = Padding.ToString();
                }
                if (!string.IsNullOrEmpty(ListStyle))
                {
                    attributes["list-style"] = ListStyle.ToString();
                }
                if (!string.IsNullOrEmpty(Float))
                {
                    attributes["float"] = Float.ToString();
                }
                if (!string.IsNullOrEmpty(Display))
                {
                    attributes[HtmlTextWriterStyle.Display] = Display.ToString();
                }
                if (!string.IsNullOrEmpty(Cursor))
                {
                    attributes[HtmlTextWriterStyle.Cursor] = Cursor.ToString();
                }



                base.FillStyleAttributes(attributes, urlResolver);

                string[] filter = new string[] { "left", "right", "top", "bottom", "width", "height", "margin-left", "margin-right", "margin-top", "margin-bottom" };
                foreach (string f in filter)
                {
                    if (!string.IsNullOrEmpty(attributes[f]))
                    {
                        attributes[f] = attributes[f].Replace(",", ".");
                    }
                }
            }
        /// <internalonly/>
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) {
            base.FillStyleAttributes(attributes, urlResolver);

            Color shadowColor = ShadowColor;
            if (shadowColor.IsEmpty == false) {
                string colorValue = ColorTranslator.ToHtml(shadowColor);
                string filterValue = "progid:DXImageTransform.Microsoft.Shadow(color='" + colorValue + "', Direction=135, Strength=3)";

                attributes.Add(HtmlTextWriterStyle.Filter, filterValue);
            }
        }
Esempio n. 5
0
		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;
		}
 public StyleBlockStyles AddStyles(CssStyleCollection styles)
 {
     if (styles != null)
     {
         foreach (string str in styles.Keys)
         {
             this._styles.Add(str, styles[str]);
         }
     }
     return this;
 }
Esempio n. 7
0
 protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes(attributes, urlResolver);
     attributes["float"] = "left";
     if (!PaddingTop.IsEmpty)
     {
         attributes[HtmlTextWriterStyle.PaddingTop] = PaddingTop.ToString();
     }
     else
     {
         attributes[HtmlTextWriterStyle.PaddingTop] = "5px";
     }
     if (!PaddingLeft.IsEmpty)
     {
         attributes[HtmlTextWriterStyle.PaddingLeft] = PaddingLeft.ToString();
     }
     else
     {
         attributes[HtmlTextWriterStyle.PaddingLeft] = "5px";
     }
 }
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) {
            // The main style will be rendered on the container element, that does not contain the text.
            // The Hyperlink style will render the text styles
            // Copying the code from the base class, except for the part that deals with Font and ForeColor.
            StateBag viewState = ViewState;
            Color c;

            // BackColor
            if (IsSet(PROP_BACKCOLOR)) {
                c = (Color)viewState["BackColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(c));
                }
            }

            // BorderColor
            if (IsSet(PROP_BORDERCOLOR)) {
                c = (Color)viewState["BorderColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(c));
                }
            }

            BorderStyle bs = this.BorderStyle;
            Unit bu = this.BorderWidth;
            if (!bu.IsEmpty) {
                attributes.Add(HtmlTextWriterStyle.BorderWidth, bu.ToString(CultureInfo.InvariantCulture));
                if (bs == BorderStyle.NotSet) {
                    if (bu.Value != 0.0) {
                        attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }
            else {
                if (bs != BorderStyle.NotSet) {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }

            Unit u;

            // Height
            if (IsSet(PROP_HEIGHT)) {
                u = (Unit)viewState["Height"];
                if (!u.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            // Width
            if (IsSet(PROP_WIDTH)) {
                u = (Unit)viewState["Width"];
                if (!u.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            if (!HorizontalPadding.IsEmpty || !VerticalPadding.IsEmpty) {
                // DevDiv Bugs 84107: Must pass InvariantCulture to Unit.ToString since Unit is not IFormattable.
                Unit verticalPadding = VerticalPadding.IsEmpty ? Unit.Pixel(0) : VerticalPadding;
                Unit horizontalPadding = HorizontalPadding.IsEmpty ? Unit.Pixel(0) : HorizontalPadding;
                attributes.Add(HtmlTextWriterStyle.Padding, string.Format(CultureInfo.InvariantCulture,
                    "{0} {1} {0} {1}",
                    verticalPadding.ToString(CultureInfo.InvariantCulture),
                    horizontalPadding.ToString(CultureInfo.InvariantCulture)));
            }
        }
 protected sealed override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     StateBag viewState = base.ViewState;
     if (this._owner.IsSet(4))
     {
         Color foreColor = this._owner.ForeColor;
         if (!foreColor.IsEmpty)
         {
             attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(foreColor));
         }
     }
     FontInfo font = this._owner.Font;
     string[] names = font.Names;
     if (names.Length > 0)
     {
         attributes.Add(HtmlTextWriterStyle.FontFamily, string.Join(",", names));
     }
     FontUnit size = font.Size;
     if (!size.IsEmpty)
     {
         attributes.Add(HtmlTextWriterStyle.FontSize, size.ToString(CultureInfo.InvariantCulture));
     }
     if (this._owner.IsSet(0x800))
     {
         if (font.Bold)
         {
             attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
         }
         else
         {
             attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
         }
     }
     if (this._owner.IsSet(0x1000))
     {
         if (font.Italic)
         {
             attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
         }
         else
         {
             attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
         }
     }
     string str = string.Empty;
     if (font.Underline)
     {
         str = "underline";
     }
     if (font.Overline)
     {
         str = str + " overline";
     }
     if (font.Strikeout)
     {
         str = str + " line-through";
     }
     if (str.Length > 0)
     {
         attributes.Add(HtmlTextWriterStyle.TextDecoration, str);
     }
     else if (!this.DoNotRenderDefaults)
     {
         attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
     }
     if (this._owner.IsSet(2))
     {
         attributes.Add(HtmlTextWriterStyle.BorderStyle, "none");
     }
 }
Esempio n. 10
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) {
            // The style will be rendered on container elements that does not contain text directly.
            // It does not render font and forecolor.
            // Users should set font and forecolor on MenuItems styles.
            // Copying the code from the base class, except for the part that deals with Font and ForeColor.
            StateBag viewState = ViewState;
            Color c;

            // BackColor
            if (base.IsSet(PROP_BACKCOLOR)) {
                c = (Color)viewState["BackColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(c));
                }
            }

            // BorderColor
            if (base.IsSet(PROP_BORDERCOLOR)) {
                c = (Color)viewState["BorderColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(c));
                }
            }

            BorderStyle bs = this.BorderStyle;
            Unit bu = this.BorderWidth;
            if (!bu.IsEmpty) {
                attributes.Add(HtmlTextWriterStyle.BorderWidth, bu.ToString(CultureInfo.InvariantCulture));
                if (bs == BorderStyle.NotSet) {
                    if (bu.Value != 0.0) {
                        attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }
            else {
                if (bs != BorderStyle.NotSet) {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }

            Unit u;

            // Height
            if (base.IsSet(PROP_HEIGHT)) {
                u = (Unit)viewState["Height"];
                if (!u.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            // Width
            if (base.IsSet(PROP_WIDTH)) {
                u = (Unit)viewState["Width"];
                if (!u.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            if (!HorizontalPadding.IsEmpty || !VerticalPadding.IsEmpty) {
                attributes.Add(HtmlTextWriterStyle.Padding, string.Format(CultureInfo.InvariantCulture,
                    "{0} {1} {0} {1}",
                    VerticalPadding.IsEmpty ? Unit.Pixel(0) : VerticalPadding,
                    HorizontalPadding.IsEmpty ? Unit.Pixel(0) : HorizontalPadding));
            }
        }
Esempio n. 11
0
			protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
			{
				UrlResolver = urlResolver;
				base.FillStyleAttributes (attributes, urlResolver);
			}
Esempio n. 12
0
		protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver) {
			base.FillStyleAttributes (attributes, urlResolver);
			attributes.Add ("FillStyleAttributes", "FillStyleAttributes");
		}
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of a CssCollection with an CssStyleCollection.
 /// </summary>
 /// <param name="style">A CssStyleCollection to initialize the collection.</param>
 public CssCollection(CssStyleCollection style)
     : base()
 {
     Merge(style, true);
 }
Esempio n. 14
0
 protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     _popup._savedCSS = attributes.Value;
     attributes.Add(HtmlTextWriterStyle.Position, "absolute");
     attributes.Add(HtmlTextWriterStyle.Top, "-2000px");
     attributes.Add(HtmlTextWriterStyle.Left, "-2000px");
 }
Esempio n. 15
0
		public void FixtureSetUp ()
		{
			css = new Table ().Style;
		}
            /// <summary>
            /// Fills Style attribute to the base.
            /// </summary>
            /// <param name="attributes"></param>
            /// <param name="urlResolver"></param>
            protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
            {
                base.FillStyleAttributes(attributes, urlResolver);

                attributes.Remove(HtmlTextWriterStyle.Height);
                // commented below line to fix the issue #25821
                //attributes.Remove(HtmlTextWriterStyle.BackgroundColor);
                attributes.Remove(HtmlTextWriterStyle.BackgroundImage);
            }
Esempio n. 17
0
        /// <devdoc>
        /// Retrieves the collection of CSS style attributes represented by this style.
        /// </devdoc>
        public CssStyleCollection GetStyleAttributes(IUrlResolutionService urlResolver) {
            CssStyleCollection attributes = new CssStyleCollection();

            FillStyleAttributes(attributes, urlResolver);
            return attributes;
        }
Esempio n. 18
0
		public void Fill (CssStyleCollection attributes, IUrlResolutionService urlResolver)
		{
			base.FillStyleAttributes (attributes, urlResolver);
		}
Esempio n. 19
0
        protected virtual void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) {
            StateBag viewState = ViewState;

            Color c;

            // ForeColor
            if (IsSet(PROP_FORECOLOR)) {
                c = (Color)viewState["ForeColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(c));
                }
            }

            // BackColor
            if (IsSet(PROP_BACKCOLOR)) {
                c = (Color)viewState["BackColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(c));
                }
            }

            // BorderColor
            if (IsSet(PROP_BORDERCOLOR)) {
                c = (Color)viewState["BorderColor"];
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(c));
                }
            }

            BorderStyle bs = this.BorderStyle;
            Unit bu = this.BorderWidth;
            if (!bu.IsEmpty) {
                attributes.Add(HtmlTextWriterStyle.BorderWidth, bu.ToString(CultureInfo.InvariantCulture));
                if (bs == BorderStyle.NotSet) {
                    if (bu.Value != 0.0) {
                        attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }
            else {
                if (bs != BorderStyle.NotSet) {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }

            // need to call the property get in case we have font properties from view state and have not
            // created the font object
            FontInfo font = Font;

            // Font.Names
            string[] names = font.Names;
            if (names.Length > 0) {
                attributes.Add(HtmlTextWriterStyle.FontFamily, Style.FormatStringArray(names, ','));
            }

            // Font.Size
            FontUnit fu = font.Size;
            if (fu.IsEmpty == false) {
                attributes.Add(HtmlTextWriterStyle.FontSize, fu.ToString(CultureInfo.InvariantCulture));
            }

            // Font.Bold
            if (IsSet(PROP_FONT_BOLD)) {
                if (font.Bold) {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
                }
            }

            // Font.Italic
            if (IsSet(PROP_FONT_ITALIC)) {
                if (font.Italic == true) {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
                }
            }

            // 
            string textDecoration = String.Empty;
            if (font.Underline) {
                textDecoration = "underline";
            }
            if (font.Overline) {
                textDecoration += " overline";
            }
            if (font.Strikeout) {
                textDecoration += " line-through";
            }
            if (textDecoration.Length > 0) {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, textDecoration);
            }
            else {
                if (IsSet(PROP_FONT_UNDERLINE) || IsSet(PROP_FONT_OVERLINE) || IsSet(PROP_FONT_STRIKEOUT)) {
                    attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
                }
            }

            Unit u;

            // Height
            if (IsSet(PROP_HEIGHT)) {
                u = (Unit)viewState["Height"];
                if (!u.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            // Width
            if (IsSet(PROP_WIDTH)) {
                u = (Unit)viewState["Width"];
                if (!u.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
                }
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Fills the attributes collection given with the ones from the style
        /// </summary>
        /// <param name="attributes">The atrributes</param>
        /// <param name="urlResolver">The resolver to use</param>
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);

            if(!string.IsNullOrEmpty(BackgroundImageUrl))
                attributes.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + urlResolver.ResolveClientUrl(BackgroundImageUrl) + "')");

            if(BackgroundImagePosition != BackgroundPosition.NotSet)
                attributes.Add("background-position", backgroundPos[(int)BackgroundImagePosition]);

            if(BackgroundImageRepeat != BackgroundRepeat.NotSet)
                attributes.Add("background-repeat", backgroundRpt[(int)BackgroundImageRepeat]);

            if(ZIndex != 0)
                attributes.Add(HtmlTextWriterStyle.ZIndex, ZIndex.ToString());

            if(Display != Display.NotSet)
                attributes.Add(HtmlTextWriterStyle.Display, displayStr[(int)Display]);

            if(Position != ElementPosition.NotSet)
                attributes.Add("position", positionStr[(int)Position]);

            if(!Left.IsEmpty)
                attributes.Add("left", Left.ToString());

            if(!Right.IsEmpty)
                attributes.Add("right", Right.ToString());

            if(!Top.IsEmpty)
                attributes.Add("top", Top.ToString());

            if(!Bottom.IsEmpty)
                attributes.Add("bottom", Bottom.ToString());

            if(Opacity != 1.0f)
            {
                attributes.Add("opacity", Opacity.ToString("0.0"));
                attributes.Add("-ms-filter", string.Format("progid:DXImageTransform.Microsoft.Alpha(Opacity={0:0})", Opacity * 100));
                attributes.Add("filter", string.Format("alpha(opacity={0:0})", Opacity * 100));
            }

            if(Float != ElementFloat.NotSet)
                attributes.Add("float", floatStr[(int)Float]);

            if(ListStyleType != ListStyleType.NotSet)
                attributes.Add(HtmlTextWriterStyle.ListStyleType, ListStyleTypeStr[(int)ListStyleType]);

            if(ListStylePosition != ListStylePosition.NotSet)
                attributes.Add("list-style-position", ListStylePositionStr[(int)ListStylePosition]);

            if(!string.IsNullOrEmpty(ListStyleImage))
                attributes.Add(HtmlTextWriterStyle.ListStyleImage, "url('" + urlResolver.ResolveClientUrl(ListStyleImage) + "')");
        }
Esempio n. 21
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]);
         }
     }
 }
Esempio n. 22
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);
 }
		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 sealed void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) {
            Debug.Assert(_owner != null);

            StateBag viewState = ViewState;

            Color c;

            // ForeColor
            if (_owner.IsSet(PROP_FORECOLOR)) {
                c = _owner.ForeColor;
                if (!c.IsEmpty) {
                    attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(c));
                }
            }
            // Not defaulting to black anymore for not entirely satisfying but reasonable reasons (VSWhidbey 356729)

            // need to call the property get in case we have font properties from view state and have not
            // created the font object
            FontInfo font = _owner.Font;

            // Font.Names
            string[] names = font.Names;
            if (names.Length > 0) {
                attributes.Add(HtmlTextWriterStyle.FontFamily, String.Join(",", names));
            }

            // Font.Size
            FontUnit fu = font.Size;
            if (fu.IsEmpty == false) {
                attributes.Add(HtmlTextWriterStyle.FontSize, fu.ToString(CultureInfo.InvariantCulture));
            }

            // Font.Bold
            if (_owner.IsSet(PROP_FONT_BOLD)) {
                if (font.Bold) {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
                }
            }

            // Font.Italic
            if (_owner.IsSet(PROP_FONT_ITALIC)) {
                if (font.Italic == true) {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
                }
                else {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
                }
            }

            string textDecoration = String.Empty;
            if (font.Underline) {
                textDecoration = "underline";
            }
            if (font.Overline) {
                textDecoration += " overline";
            }
            if (font.Strikeout) {
                textDecoration += " line-through";
            }
            if (textDecoration.Length > 0) {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, textDecoration);
            }
            else {
                if (!DoNotRenderDefaults) {
                    attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
                }
            }
            // Removing the border with an inline style if the class name was set
            if (_owner.IsSet(PROP_CSSCLASS)) {
                attributes.Add(HtmlTextWriterStyle.BorderStyle, "none");
            }
        }
Esempio n. 25
0
		protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
		{
			base.FillStyleAttributes (attributes, urlResolver);
			if (CheckBit ((int) MenuItemStyles.HorizontalPadding)) {
				attributes.Add (HtmlTextWriterStyle.PaddingLeft, HorizontalPadding.ToString ());
				attributes.Add (HtmlTextWriterStyle.PaddingRight, HorizontalPadding.ToString ());
			}
			if (CheckBit ((int) MenuItemStyles.VerticalPadding)) {
				attributes.Add (HtmlTextWriterStyle.PaddingTop, VerticalPadding.ToString ());
				attributes.Add (HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString ());
			}
		}
Esempio n. 26
0
            protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
            {
                base.FillStyleAttributes(attributes, urlResolver);

                attributes.Remove(HtmlTextWriterStyle.Height);
                attributes.Remove(HtmlTextWriterStyle.BackgroundColor);
                attributes.Remove(HtmlTextWriterStyle.BackgroundImage);
            }
Esempio n. 27
0
		void FillAttributes (CssStyleCollection attributes)
		{
			if (IsSet (BACKCOLOR))
				AddColor (attributes, HtmlTextWriterStyle.BackgroundColor, BackColor);

			if (IsSet(BORDERCOLOR))
				AddColor (attributes, HtmlTextWriterStyle.BorderColor, BorderColor);

			if (IsSet (FORECOLOR))
				AddColor (attributes, HtmlTextWriterStyle.Color, ForeColor);

			if (!BorderWidth.IsEmpty) {
				attributes.Add (HtmlTextWriterStyle.BorderWidth,
						BorderWidth.ToString (CultureInfo.InvariantCulture));

				if (BorderStyle != BorderStyle.NotSet) {
					attributes.Add (HtmlTextWriterStyle.BorderStyle,
							Enum.Format (typeof (BorderStyle), BorderStyle, "G"));
				} else {
					if (BorderWidth.Value != 0.0)
						attributes.Add (HtmlTextWriterStyle.BorderStyle, "solid");
				}
			} else {
				if (BorderStyle != BorderStyle.NotSet)
					attributes.Add (HtmlTextWriterStyle.BorderStyle,
							Enum.Format (typeof (BorderStyle), BorderStyle, "G"));
			}

			if (Font.Names.Length > 0)
				attributes.Add (HtmlTextWriterStyle.FontFamily,
							StringArrayToString (Font.Names, ','));

			if (!Font.Size.IsEmpty)
				attributes.Add (HtmlTextWriterStyle.FontSize,
							Font.Size.ToString (CultureInfo.InvariantCulture));

			if (Font.Bold)
				attributes.Add (HtmlTextWriterStyle.FontWeight, "bold");

			if (Font.Italic)
				attributes.Add (HtmlTextWriterStyle.FontStyle, "italic");

			string textDecoration = String.Empty;
			if (Font.Strikeout)
				textDecoration += " line-through";

			if (Font.Underline)
				textDecoration += " underline";

			if (Font.Overline)
				textDecoration += " overline";

			if (textDecoration.Length > 0)
				attributes.Add (HtmlTextWriterStyle.TextDecoration, textDecoration);

			Unit u = Unit.Empty;
			if (IsSet (HEIGHT)) {
				u = (Unit) ViewState ["Height"];
				if (!u.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.Height,
								u.ToString (CultureInfo.InvariantCulture));
			}

			if (IsSet (WIDTH)) {
				u = (Unit) ViewState ["Width"];
				if (!u.IsEmpty)
					attributes.Add (HtmlTextWriterStyle.Width,
								u.ToString (CultureInfo.InvariantCulture));
			}
		}
 protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
 {
     Color color;
     Unit unit2;
     StateBag viewState = base.ViewState;
     if (base.IsSet(8))
     {
         color = (Color) viewState["BackColor"];
         if (!color.IsEmpty)
         {
             attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
         }
     }
     if (base.IsSet(0x10))
     {
         color = (Color) viewState["BorderColor"];
         if (!color.IsEmpty)
         {
             attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
         }
     }
     BorderStyle borderStyle = base.BorderStyle;
     Unit borderWidth = base.BorderWidth;
     if (!borderWidth.IsEmpty)
     {
         attributes.Add(HtmlTextWriterStyle.BorderWidth, borderWidth.ToString(CultureInfo.InvariantCulture));
         if (borderStyle == BorderStyle.NotSet)
         {
             if (borderWidth.Value != 0.0)
             {
                 attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
             }
         }
         else
         {
             attributes.Add(HtmlTextWriterStyle.BorderStyle, Style.borderStyles[(int) borderStyle]);
         }
     }
     else if (borderStyle != BorderStyle.NotSet)
     {
         attributes.Add(HtmlTextWriterStyle.BorderStyle, Style.borderStyles[(int) borderStyle]);
     }
     if (base.IsSet(0x80))
     {
         unit2 = (Unit) viewState["Height"];
         if (!unit2.IsEmpty)
         {
             attributes.Add(HtmlTextWriterStyle.Height, unit2.ToString(CultureInfo.InvariantCulture));
         }
     }
     if (base.IsSet(0x100))
     {
         unit2 = (Unit) viewState["Width"];
         if (!unit2.IsEmpty)
         {
             attributes.Add(HtmlTextWriterStyle.Width, unit2.ToString(CultureInfo.InvariantCulture));
         }
     }
     if (!this.HorizontalPadding.IsEmpty || !this.VerticalPadding.IsEmpty)
     {
         Unit unit3 = this.VerticalPadding.IsEmpty ? Unit.Pixel(0) : this.VerticalPadding;
         Unit unit4 = this.HorizontalPadding.IsEmpty ? Unit.Pixel(0) : this.HorizontalPadding;
         attributes.Add(HtmlTextWriterStyle.Padding, string.Format(CultureInfo.InvariantCulture, "{0} {1} {0} {1}", new object[] { unit3.ToString(CultureInfo.InvariantCulture), unit4.ToString(CultureInfo.InvariantCulture) }));
     }
 }
Esempio n. 29
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];
         }
     }
 }
        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 ());
        }
Esempio n. 31
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 ());
			}
		}
Esempio n. 32
0
		protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
		{
			if (attributes != null) {
				string url = BackImageUrl;
				if (url.Length > 0) {
					if (urlResolver != null)
						url = urlResolver.ResolveClientUrl (url);
					attributes.Add (HtmlTextWriterStyle.BackgroundImage, url);
				}
			}
			base.FillStyleAttributes (attributes, urlResolver);
		}
Esempio n. 33
0
        /// <internalonly/>
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) {
            base.FillStyleAttributes(attributes, urlResolver);

            string s = BackImageUrl;
            if (s.Length != 0) {
                if (urlResolver != null) {
                    s = urlResolver.ResolveClientUrl(s);
                }
                attributes.Add(HtmlTextWriterStyle.BackgroundImage, s);
            }
        }