当前位置: 首页>>代码示例>>C#>>正文


C# Style.AddAttributesToRender方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.Style.AddAttributesToRender方法的典型用法代码示例。如果您正苦于以下问题:C# Style.AddAttributesToRender方法的具体用法?C# Style.AddAttributesToRender怎么用?C# Style.AddAttributesToRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.Style的用法示例。


在下文中一共展示了Style.AddAttributesToRender方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderHeader

 protected override void RenderHeader(HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
     writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     TitleStyle headerStyle = base.HeaderStyle;
     if (!headerStyle.IsEmpty)
     {
         Style style2 = new Style();
         if (!headerStyle.ForeColor.IsEmpty)
         {
             style2.ForeColor = headerStyle.ForeColor;
         }
         style2.Font.CopyFrom(headerStyle.Font);
         if (!headerStyle.Font.Size.IsEmpty)
         {
             style2.Font.Size = new FontUnit(new Unit(100.0, UnitType.Percentage));
         }
         if (!style2.IsEmpty)
         {
             style2.AddAttributesToRender(writer, this);
         }
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Table);
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     HorizontalAlign horizontalAlign = headerStyle.HorizontalAlign;
     if (horizontalAlign != HorizontalAlign.NotSet)
     {
         TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
         writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign));
     }
     writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     writer.Write(this.DisplayTitle);
     writer.RenderEndTag();
     writer.RenderEndTag();
     writer.RenderEndTag();
 }
开发者ID:t1b1c,项目名称:lwas,代码行数:39,代码来源:StyledWebPartZone.cs

示例2: RenderHeader

        protected override void RenderHeader(HtmlTextWriter writer) {

            // 




            // Render title bar
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

            TitleStyle headerStyle = HeaderStyle;
            if (!headerStyle.IsEmpty) {
                // Apply font and forecolor from HeaderStyle to inner table
                Style style = new Style();
                if (!headerStyle.ForeColor.IsEmpty) {
                    style.ForeColor = headerStyle.ForeColor;
                }
                style.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty) {
                    // If the font size is specified on the HeaderStyle, force the font size to 100%,
                    // so it inherits the font size from its parent in IE compatibility mode. I would
                    // think that "1em" would work here as well, but "1em" doesn't work when you change
                    // the font size in the browser.
                    style.Font.Size = new FontUnit(new Unit(100, UnitType.Percentage));
                }
                if (!style.IsEmpty) {
                    style.AddAttributesToRender(writer, this);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Copied from Panel.cs
            // 
            HorizontalAlign hAlign = headerStyle.HorizontalAlign;
            if (hAlign != HorizontalAlign.NotSet) {
                TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign));
            }

            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(DisplayTitle);
            writer.RenderEndTag();  // Td

            writer.RenderEndTag();  // Tr
            writer.RenderEndTag();  // Table
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:53,代码来源:WebPartZoneBase.cs

示例3: RenderBody

        protected override void RenderBody(HtmlTextWriter writer) {
            Orientation orientation = LayoutOrientation;

            if (DesignMode || (WebPartManager != null && (WebPartManager.DisplayMode.AllowPageDesign))) {
                if (_borderColor != Color.Empty || _borderStyle != BorderStyle.NotSet || _borderWidth != Unit.Empty) {
                    Style s = new Style();
                    s.BorderColor = _borderColor;
                    s.BorderStyle = _borderStyle;
                    s.BorderWidth = _borderWidth;
                    s.AddAttributesToRender(writer, this);
                }
            }

            RenderBodyTableBeginTag(writer);
            if (DesignMode) {
                RenderDesignerRegionBeginTag(writer, orientation);
            }

            if (orientation == Orientation.Horizontal) {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }

            bool dragDropEnabled = DragDropEnabled;
            if (dragDropEnabled) {
                RenderDropCue(writer);
            }

            WebPartCollection webParts = WebParts;
            if (webParts == null || webParts.Count == 0) {
                RenderEmptyZoneBody(writer);
            }
            else {
                WebPartChrome chrome = WebPartChrome;
                foreach (WebPart webPart in webParts) {
                    // Don't render anything visible for a  minimized part if its effective frame
                    // type dictates that a title bar will not be rendered. (VSWhidbey 77730)
                    if (webPart.ChromeState == PartChromeState.Minimized) {
                        PartChromeType chromeType = GetEffectiveChromeType(webPart);
                        if (chromeType == PartChromeType.None || chromeType == PartChromeType.BorderOnly) {
                            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                        }
                    }


                    if (orientation == Orientation.Vertical) {
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    }
                    else {
                        // Mac IE needs height=100% set on <td> instead of <tr>
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");
                        writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);

                    chrome.RenderWebPart(writer, webPart);

                    writer.RenderEndTag();      // Td
                    if (orientation == Orientation.Vertical) {
                        writer.RenderEndTag();  // Tr
                    }

                    if (dragDropEnabled) {
                        RenderDropCue(writer);
                    }
                }

                if (orientation == Orientation.Vertical) {
                    // Add an extra row with height of 100%, to [....] up any extra space
                    // if the height of the zone is larger than its contents
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                    // Mozilla renders padding on an empty TD without this attribute
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");

                    // Mac IE needs height=100% set on <td> instead of <tr>
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");

                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.RenderEndTag(); // Td
                    writer.RenderEndTag(); // Tr
                }
                else {
                    // Add an extra cell with width of 100%, to [....] up any extra space
                    // if the width of the zone is larger than its contents.
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

                    // Mozilla renders padding on an empty TD without this attribute
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");

                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.RenderEndTag(); // Td
                }
            }

            if (orientation == Orientation.Horizontal) {
                writer.RenderEndTag();  // Tr
            }

            if (DesignMode) {
                RenderDesignerRegionEndTag(writer);
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:WebPartZoneBase.cs

示例4: EnterStyle

 public virtual void EnterStyle(Style style, HtmlTextWriterTag tag) {
     if (!style.IsEmpty || tag != HtmlTextWriterTag.Span) {
         style.AddAttributesToRender(this);
         RenderBeginTag(tag);
     }
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:6,代码来源:HTMLTextWriter.cs

示例5: AddNodeLinkStyle

		void AddNodeLinkStyle (HtmlTextWriter writer, TreeNode node, int level, bool nodeIsSelected)
		{
			Style style = new Style ();
#if NET_4_0
			bool addBorderStyle = false;
#endif
			if (Page.Header != null) {
				// styles are registered
				style.AddCssClass (ControlLinkStyle.RegisteredCssClass);

				if (nodeStyle != null) {
					style.AddCssClass (nodeLinkStyle.CssClass);
					style.AddCssClass (nodeLinkStyle.RegisteredCssClass);
				}

				if (levelLinkStyles != null && levelLinkStyles.Count > level) {
					style.AddCssClass (levelLinkStyles [level].CssClass);
					style.AddCssClass (levelLinkStyles [level].RegisteredCssClass);
#if NET_4_0
					addBorderStyle = true;
#endif
				}
				
				if (node.IsLeafNode) {
					if (leafNodeStyle != null) {
						style.AddCssClass (leafNodeLinkStyle.CssClass);
						style.AddCssClass (leafNodeLinkStyle.RegisteredCssClass);
					}
				} else if (node.IsRootNode) {
					if (rootNodeStyle != null) {
						style.AddCssClass (rootNodeLinkStyle.CssClass);
						style.AddCssClass (rootNodeLinkStyle.RegisteredCssClass);
					}
				} else if (node.IsParentNode) {
					if (parentNodeStyle != null) {
						style.AddCssClass (parentNodeLinkStyle.CssClass);
						style.AddCssClass (parentNodeLinkStyle.RegisteredCssClass);
					}
				}
				
				if (nodeIsSelected) {
					style.AddCssClass (selectedNodeLinkStyle.CssClass);
					style.AddCssClass (selectedNodeLinkStyle.RegisteredCssClass);
				}
			} else {
				// styles are not registered
				style.CopyFrom (ControlLinkStyle);
				if (nodeStyle != null)
					style.CopyFrom (nodeLinkStyle);
				
				if (levelLinkStyles != null && levelLinkStyles.Count > level) {
					style.CopyFrom (levelLinkStyles [level]);
#if NET_4_0
					addBorderStyle = true;
#endif
				}
				
				if (node.IsLeafNode) {
					if (node.IsLeafNode && leafNodeStyle != null)
						style.CopyFrom (leafNodeLinkStyle);
				} else if (node.IsRootNode) {
					if (node.IsRootNode && rootNodeStyle != null)
						style.CopyFrom (rootNodeLinkStyle);
				} else if (node.IsParentNode) {
					if (node.IsParentNode && parentNodeStyle != null)
						style.CopyFrom (parentNodeLinkStyle);
				}
				
				if (nodeIsSelected)
					style.CopyFrom (selectedNodeLinkStyle);
				
				style.AlwaysRenderTextDecoration = true;
			}
#if NET_4_0
			if (addBorderStyle) {
				// This appears not to come from any style. Instead, it's added
				// whenever a level style is present.
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "none");
				writer.AddStyleAttribute (HtmlTextWriterStyle.FontSize, "1em");
			}		
#endif
			style.AddAttributesToRender (writer);
		}
开发者ID:tgiphil,项目名称:mono,代码行数:83,代码来源:TreeView.cs

示例6: Style_AddRegisteredCssClassAttribute_Load

		public static void Style_AddRegisteredCssClassAttribute_Load (Page p) {
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			Style s = new Style ();
			s.CssClass = "MyClass";
			s.BackColor = Color.AliceBlue;
			s.AddAttributesToRender (tw);
			tw.RenderBeginTag ("span");
			tw.RenderEndTag ();
			Assert.AreEqual (true, sw.ToString ().Contains ("class=\"MyClass\""), "AddRegisteredCssClassAttribute#1");
			Assert.AreEqual (true, sw.ToString ().Contains ("style"), "AddRegisteredCssClassAttribute#2");
			
			sw = new StringWriter ();
			tw = new HtmlTextWriter (sw);
			s = new Style ();
			s.BackColor = Color.AliceBlue;
			p.Header.StyleSheet.RegisterStyle (s, p);
			s.AddAttributesToRender (tw);
			tw.RenderBeginTag ("span");
			tw.RenderEndTag ();
			Assert.AreEqual (true, sw.ToString ().Contains ("class"), "AddRegisteredCssClassAttribute#3");
			Assert.AreEqual (false, sw.ToString ().Contains ("style"), "AddRegisteredCssClassAttribute#4");
			
			sw = new StringWriter ();
			tw = new HtmlTextWriter (sw);
			s = new Style ();
			s.BackColor = Color.AliceBlue;
			s.CssClass = "MyClass";
			p.Header.StyleSheet.RegisterStyle (s, p);
			s.AddAttributesToRender (tw);
			tw.RenderBeginTag ("span");
			tw.RenderEndTag ();
			Assert.AreEqual (sw.ToString ().LastIndexOf ("class"), sw.ToString ().IndexOf ("class"), "AddRegisteredCssClassAttribute#5");
			Assert.AreEqual (false, sw.ToString ().Contains ("style"), "AddRegisteredCssClassAttribute#6");
			Assert.AreEqual (true, sw.ToString ().Contains ("class=\"MyClass "), "AddRegisteredCssClassAttribute#7");

			s = new Style ();
			p.Header.StyleSheet.RegisterStyle (s, p);
			Assert.AreEqual (false, s.IsEmpty, "AddRegisteredCssClassAttribute#8");
		}
开发者ID:nobled,项目名称:mono,代码行数:40,代码来源:StyleTest.cs

示例7: RenderMenuItem


//.........这里部分代码省略.........
					if (isDynamicItem && dynamicSelectedStyle != null) {
						AddCssClass (style, dynamicSelectedStyle.CssClass);
						AddCssClass (style, dynamicSelectedStyle.RegisteredCssClass);
					}
					if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
						AddCssClass (style, levelSelectedStyles [item.Depth].CssClass);
						AddCssClass (style, levelSelectedStyles [item.Depth].RegisteredCssClass);
					}
				}
			}
			else {
				// styles are not registered
				if (!isDynamicItem && staticMenuItemStyle != null) {
					style.CopyFrom (staticMenuItemStyle);
				}
				if (isDynamicItem && dynamicMenuItemStyle != null) {
					style.CopyFrom (dynamicMenuItemStyle);
				}
				if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
					style.CopyFrom (levelMenuItemStyles [item.Depth]);
				}
				if (item == SelectedItem) {
					if (!isDynamicItem && staticSelectedStyle != null) {
						style.CopyFrom (staticSelectedStyle);
					}
					if (isDynamicItem && dynamicSelectedStyle != null) {
						style.CopyFrom (dynamicSelectedStyle);
					}
					if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
						style.CopyFrom (levelSelectedStyles [item.Depth]);
					}
				}
			}
			style.AddAttributesToRender (writer);

			writer.AddAttribute ("id", GetItemClientId (item, "i"));

			writer.AddAttribute ("cellpadding", "0", false);
			writer.AddAttribute ("cellspacing", "0", false);
			writer.AddAttribute ("border", "0", false);
			writer.AddAttribute ("width", "100%", false);
			writer.RenderBeginTag (HtmlTextWriterTag.Table);
			writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			// Menu item text

			if (vertical)
				writer.AddStyleAttribute (HtmlTextWriterStyle.Width, "100%");
			if (!ItemWrap)
				writer.AddStyleAttribute ("white-space", "nowrap");
			writer.RenderBeginTag (HtmlTextWriterTag.Td);

			RenderItemHref (writer, item);
			
			Style linkStyle = new Style ();
			if (Page.Header != null) {
				// styles are registered
				AddCssClass (linkStyle, ControlLinkStyle.RegisteredCssClass);

				if (!isDynamicItem && staticMenuItemStyle != null) {
					AddCssClass (linkStyle, staticMenuItemStyle.CssClass);
					AddCssClass (linkStyle, staticMenuItemLinkStyle.RegisteredCssClass);
				}
				if (isDynamicItem && dynamicMenuItemStyle != null) {
					AddCssClass (linkStyle, dynamicMenuItemStyle.CssClass);
					AddCssClass (linkStyle, dynamicMenuItemLinkStyle.RegisteredCssClass);
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:67,代码来源:Menu.cs

示例8: RenderEventRow

        protected void RenderEventRow(HtmlTextWriter writer, DateTime rowStart)
        {
            DateTime rowEnd = rowStart.Date.AddDays(6);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "events");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            CalendarEvent[] events = this._provider.GetEvents(this.DisplayUserKey, rowStart.Date, rowEnd.Date);
            if (events.Length == 0)
            {
                for (int i = 0; i < 7; i++)
                    this.RenderEmptyEvent(writer);
            }
            else
            {
                Style eventTextStyle = new Style();
                eventTextStyle.MergeWith(this._eventStyle);
                eventTextStyle.BorderStyle = BorderStyle.None;

                List<CalendarEvent> unrenderedEvents = new List<CalendarEvent>(events);
                DateTime curDay = rowStart;
                while (unrenderedEvents.Count > 0)
                {
                    // Doing the event this way, lets us put multiple events on the same
                    //   row, so long as they don't "interfere" with each other.
                    CalendarEvent curEv = null;
                    if (curDay.Date == rowStart.Date)
                        // Make sure that we only allow events to occured before the
                        //   "current" date if we're on the first cell in the row.
                        curEv = unrenderedEvents.Where(e => e.EventStartDate.Date <= curDay.Date).FirstOrDefault();
                    else
                        curEv = unrenderedEvents.Where(e => e.EventStartDate.Date == curDay.Date).FirstOrDefault();

                    while (curEv == null && curDay.Date <= rowEnd.Date)
                    {
                        this.RenderEmptyEvent(writer);
                        curDay = curDay.AddDays(1);
                        curEv = unrenderedEvents.Where(e => e.EventStartDate.Date == curDay.Date).FirstOrDefault();
                    }

                    if (curEv == null)
                    {
                        // If we still have no current event at this point, end this row,
                        //   start a new one, and let the search start over.
                        curDay = rowStart;
                        writer.RenderEndTag(); // TR (event row)
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "events");
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    }
                    else
                    {
                        // Now, we write the actual event.
                        int eventDays = curEv.EventEndDate.Date <= rowEnd.Date
                            ? (int)System.Math.Ceiling(curEv.EventEndDate.Subtract(curDay).TotalDays)
                            : (int)System.Math.Ceiling(rowEnd.Subtract(curDay).TotalDays) + 1;
                        if (eventDays > 1)
                            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, eventDays.ToString());
                        if (curEv.EventStartDate < rowStart && curEv.EventEndDate > rowEnd)
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evMid");
                        else if (curEv.EventStartDate < rowStart)
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evEnd");
                        else if (curEv.EventEndDate > rowEnd)
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evStart");
                        else
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evFull");
                        if (this.ControlStyle != null)
                        {
                            System.Web.UI.WebControls.Style tdStyle = new Style();
                            tdStyle.BorderStyle = this.ControlStyle.BorderStyle;
                            tdStyle.BorderColor = this.ControlStyle.BorderColor;
                            tdStyle.BorderWidth = this.ControlStyle.BorderWidth;
                            tdStyle.ForeColor = this.ControlStyle.ForeColor;
                            tdStyle.BackColor = this.ControlStyle.BackColor;
                            tdStyle.AddAttributesToRender(writer);
                        }
                        writer.RenderBeginTag(HtmlTextWriterTag.Td);

                        //if (curEv.EventStartDate < rowStart && curEv.EventEndDate > rowEnd)
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evMid");
                        //else if (curEv.EventStartDate < rowStart)
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evEnd");
                        //else if (curEv.EventEndDate > rowEnd)
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evStart");
                        //else
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evFull");
                        this._eventStyle.AddAttributesToRender(writer);
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);

                        LinkButton lnkEvent = new LinkButton();
                        lnkEvent.ID = "lnkEvent_" + curEv.ProviderEventKey + "_" + curDay.ToString("yyyyMMdd");
                        lnkEvent.Text = (curEv.EventStartDate.Date == curDay.Date)
                            ? string.Format("{0} {1}", curEv.EventStartDate.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortTimePattern), curEv.Subject)
                            : string.Format("<< {0}", curEv.Subject);
                        lnkEvent.ApplyStyle(eventTextStyle);
                        lnkEvent.CommandName = "ShowEvent";
                        lnkEvent.CommandArgument = curEv.ProviderEventKey.ToString();
                        lnkEvent.Command += new CommandEventHandler(this.lnkEvent_Command);

                        this.Controls.Add(lnkEvent);
                        lnkEvent.RenderControl(writer);
//.........这里部分代码省略.........
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:101,代码来源:CalendarView.cs

示例9: RenderMenuItem

		protected override void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool vertical, bool notLast, bool isFirst, OwnerContext oc)
		{
			Menu owner = Owner;
			string clientID = oc.ClientID;
			bool displayChildren = owner.DisplayChildren (item);
			bool dynamicChildren = displayChildren && (item.Depth + 1 >= oc.StaticDisplayLevels);
			bool isDynamicItem = IsDynamicItem (owner, item);
			bool isVertical = oc.IsVertical || isDynamicItem;
			Unit itemSpacing = owner.GetItemSpacing (item, isDynamicItem);

			if (itemSpacing != Unit.Empty && (item.Depth > 0 || !isFirst))
				RenderMenuItemSpacing (writer, itemSpacing, isVertical);

			if(!String.IsNullOrEmpty(item.ToolTip))
				writer.AddAttribute (HtmlTextWriterAttribute.Title, item.ToolTip);
			if (isVertical)
				writer.RenderBeginTag (HtmlTextWriterTag.Tr);

			string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
			if (dynamicChildren) {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
			} else if (isDynamicItem) {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverDynamicLeafItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
			} else {
				writer.AddAttribute ("onmouseover",
						     "javascript:Menu_OverStaticLeafItem ('" + clientID + "','" + item.Path + "')");
				writer.AddAttribute ("onmouseout",
						     "javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
			}

			writer.RenderBeginTag (HtmlTextWriterTag.Td);

			// Top separator image

			if (isDynamicItem)
				RenderSeparatorImage (owner, writer, oc.DynamicTopSeparatorImageUrl, false);
			else
				RenderSeparatorImage (owner, writer, oc.StaticTopSeparatorImageUrl, false);

			// Menu item box
			
			MenuItemStyle style = new MenuItemStyle ();
				
			if (oc.Header != null) {
				// styles are registered
				if (!isDynamicItem && oc.StaticMenuItemStyle != null) {
					AddCssClass (style, oc.StaticMenuItemStyle.CssClass);
					AddCssClass (style, oc.StaticMenuItemStyle.RegisteredCssClass);
				}
				if (isDynamicItem && oc.DynamicMenuItemStyle != null) {
					AddCssClass (style, oc.DynamicMenuItemStyle.CssClass);
					AddCssClass (style, oc.DynamicMenuItemStyle.RegisteredCssClass);
				}
				if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth) {
					AddCssClass (style, oc.LevelMenuItemStyles [item.Depth].CssClass);
					AddCssClass (style, oc.LevelMenuItemStyles [item.Depth].RegisteredCssClass);
				}
				if (item == oc.SelectedItem) {
					if (!isDynamicItem && oc.StaticSelectedStyle != null) {
						AddCssClass (style, oc.StaticSelectedStyle.CssClass);
						AddCssClass (style, oc.StaticSelectedStyle.RegisteredCssClass);
					}
					if (isDynamicItem && oc.DynamicSelectedStyle != null) {
						AddCssClass (style, oc.DynamicSelectedStyle.CssClass);
						AddCssClass (style, oc.DynamicSelectedStyle.RegisteredCssClass);
					}
					if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth) {
						AddCssClass (style, oc.LevelSelectedStyles [item.Depth].CssClass);
						AddCssClass (style, oc.LevelSelectedStyles [item.Depth].RegisteredCssClass);
					}
				}
			} else {
				// styles are not registered
				if (!isDynamicItem && oc.StaticMenuItemStyle != null)
					style.CopyFrom (oc.StaticMenuItemStyle);
				if (isDynamicItem && oc.DynamicMenuItemStyle != null)
					style.CopyFrom (oc.DynamicMenuItemStyle);
				if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
					style.CopyFrom (oc.LevelMenuItemStyles [item.Depth]);
				if (item == oc.SelectedItem) {
					if (!isDynamicItem && oc.StaticSelectedStyle != null)
						style.CopyFrom (oc.StaticSelectedStyle);
					if (isDynamicItem && oc.DynamicSelectedStyle != null)
						style.CopyFrom (oc.DynamicSelectedStyle);
					if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
						style.CopyFrom (oc.LevelSelectedStyles [item.Depth]);
				}
			}
			style.AddAttributesToRender (writer);

			writer.AddAttribute ("id", GetItemClientId (clientID, item, "i"));
			writer.AddAttribute ("cellpadding", "0", false);
			writer.AddAttribute ("cellspacing", "0", false);
			writer.AddAttribute ("border", "0", false);
//.........这里部分代码省略.........
开发者ID:Profit0004,项目名称:mono,代码行数:101,代码来源:MenuTableRenderer.cs

示例10: RenderHeader

 protected override void RenderHeader(HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
     writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     TitleStyle headerStyle = base.HeaderStyle;
     if (!headerStyle.IsEmpty)
     {
         Style style2 = new Style();
         if (!headerStyle.ForeColor.IsEmpty)
         {
             style2.ForeColor = headerStyle.ForeColor;
         }
         style2.Font.CopyFrom(headerStyle.Font);
         if (!headerStyle.Font.Size.IsEmpty)
         {
             style2.Font.Size = new FontUnit(new Unit(100.0, UnitType.Percentage));
         }
         if (!style2.IsEmpty)
         {
             style2.AddAttributesToRender(writer, this);
         }
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Table);
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     HorizontalAlign horizontalAlign = headerStyle.HorizontalAlign;
     if (horizontalAlign != HorizontalAlign.NotSet)
     {
         TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
         writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign));
     }
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     writer.Write(this.HeaderText);
     writer.RenderEndTag();
     WebPartVerb headerCloseVerb = this.HeaderCloseVerb;
     if (headerCloseVerb.Visible)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
         writer.RenderBeginTag(HtmlTextWriterTag.Td);
         ZoneLinkButton button = new ZoneLinkButton(this, headerCloseVerb.EventArgument) {
             Text = headerCloseVerb.Text,
             ImageUrl = headerCloseVerb.ImageUrl,
             ToolTip = headerCloseVerb.Description,
             Enabled = headerCloseVerb.Enabled,
             Page = this.Page
         };
         button.ApplyStyle(this.HeaderVerbStyle);
         button.RenderControl(writer);
         writer.RenderEndTag();
     }
     writer.RenderEndTag();
     writer.RenderEndTag();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:56,代码来源:ToolZone.cs

示例11: AddNodeLinkStyle

		void AddNodeLinkStyle (HtmlTextWriter writer, TreeNode node, int level, bool nodeIsSelected)
		{
			Style style = new Style ();
			if (Page.Header != null) {
				// styles are registered
				style.AddCssClass (ControlLinkStyle.RegisteredCssClass);

				if (nodeStyle != null) {
					style.AddCssClass (nodeLinkStyle.CssClass);
					style.AddCssClass (nodeLinkStyle.RegisteredCssClass);
				}

				if (levelLinkStyles != null && levelLinkStyles.Count > level) {
					style.AddCssClass (levelLinkStyles [level].CssClass);
					style.AddCssClass (levelLinkStyles [level].RegisteredCssClass);
				}
				
				if (node.IsLeafNode) {
					if (leafNodeStyle != null) {
						style.AddCssClass (leafNodeLinkStyle.CssClass);
						style.AddCssClass (leafNodeLinkStyle.RegisteredCssClass);
					}
				} else if (node.IsRootNode) {
					if (rootNodeStyle != null) {
						style.AddCssClass (rootNodeLinkStyle.CssClass);
						style.AddCssClass (rootNodeLinkStyle.RegisteredCssClass);
					}
				} else if (node.IsParentNode) {
					if (parentNodeStyle != null) {
						style.AddCssClass (parentNodeLinkStyle.CssClass);
						style.AddCssClass (parentNodeLinkStyle.RegisteredCssClass);
					}
				}
				
				if (nodeIsSelected) {
					style.AddCssClass (selectedNodeLinkStyle.CssClass);
					style.AddCssClass (selectedNodeLinkStyle.RegisteredCssClass);
				}
			} else {
				// styles are not registered
				style.CopyFrom (ControlLinkStyle);
				if (nodeStyle != null)
					style.CopyFrom (nodeLinkStyle);

				if (levelLinkStyles != null && levelLinkStyles.Count > level)
					style.CopyFrom (levelLinkStyles [level]);
				
				if (node.IsLeafNode) {
					if (node.IsLeafNode && leafNodeStyle != null) {
						style.CopyFrom (leafNodeLinkStyle);
					}
				} else if (node.IsRootNode) {
					if (node.IsRootNode && rootNodeStyle != null) {
						style.CopyFrom (rootNodeLinkStyle);
					}
				} else if (node.IsParentNode) {
					if (node.IsParentNode && parentNodeStyle != null) {
						style.CopyFrom (parentNodeLinkStyle);
					}
				}
				
				if (nodeIsSelected)
					style.CopyFrom (selectedNodeLinkStyle);
				style.AlwaysRenderTextDecoration = true;
			}
			style.AddAttributesToRender (writer);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:67,代码来源:TreeView.cs

示例12: RenderMenuItem

		protected override void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool vertical, bool notLast, bool isFirst, OwnerContext oc)
		{
			Menu owner = Owner;
			string clientID = oc.ClientID;
			bool displayChildren = owner.DisplayChildren (item);
			bool isDynamicItem = IsDynamicItem (owner, item);
			int itemLevel = item.Depth + 1;
			string str;
			
			writer.RenderBeginTag (HtmlTextWriterTag.Li);

			if (isDynamicItem)
				RenderSeparatorImage (owner, writer, oc.DynamicTopSeparatorImageUrl, true);
			else
				RenderSeparatorImage (owner, writer, oc.StaticTopSeparatorImageUrl, true);
			
			var linkStyle = new Style ();
			if (displayChildren && (isDynamicItem || itemLevel >= oc.StaticDisplayLevels))
				AddCssClass (linkStyle, isDynamicItem && haveDynamicPopOut ? "popout-dynamic" : "popout");
			AddCssClass (linkStyle, "level" + itemLevel);

			MenuItemStyleCollection levelStyles = oc.LevelMenuItemStyles;
			if (levelStyles != null && levelStyles.Count >= itemLevel) {
				MenuItemStyle style = levelStyles [itemLevel - 1];
				string cssClass = style.CssClass;
				if (!String.IsNullOrEmpty (cssClass))
					AddCssClass (linkStyle, cssClass);
			}

			if (owner.SelectedItem == item)
				AddCssClass (linkStyle, "selected");
			
			str = item.ToolTip;
			if (!String.IsNullOrEmpty (str))
				writer.AddAttribute ("title", str);
			linkStyle.AddAttributesToRender (writer);
			RenderItemHref (owner, writer, item);
			writer.RenderBeginTag (HtmlTextWriterTag.A);
			owner.RenderItemContent (writer, item, isDynamicItem);
			writer.RenderEndTag ();

			str = item.SeparatorImageUrl;
			if (String.IsNullOrEmpty (str)) {
				if (isDynamicItem)
					str = oc.DynamicBottomSeparatorImageUrl;
				else
					str = oc.StaticBottomSeparatorImageUrl;
			}
			RenderSeparatorImage (owner, writer, str, true);

			// if (itemLevel == 1)
			// 	writer.RenderEndTag (); // </li>
			
			if (displayChildren)
				owner.RenderMenu (writer, item.ChildItems, vertical, isDynamicItem, itemLevel, notLast);

			if (itemLevel > 1)
				writer.RenderEndTag (); // </li>
		}
开发者ID:alisci01,项目名称:mono,代码行数:59,代码来源:MenuListRenderer.cs

示例13: RenderEmptyEvent

 protected void RenderEmptyEvent(HtmlTextWriter writer)
 {
     if (this.ControlStyle != null)
     {
         System.Web.UI.WebControls.Style tdStyle = new Style();
         tdStyle.BorderStyle = this.ControlStyle.BorderStyle;
         tdStyle.BorderColor = this.ControlStyle.BorderColor;
         tdStyle.BorderWidth = this.ControlStyle.BorderWidth;
         tdStyle.ForeColor = this.ControlStyle.ForeColor;
         tdStyle.BackColor = this.ControlStyle.BackColor;
         tdStyle.AddAttributesToRender(writer);
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     writer.AddAttribute(HtmlTextWriterAttribute.Class, "NoEvent");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     writer.Write("&nbsp;");
     writer.RenderEndTag();
     writer.RenderEndTag();
 }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:19,代码来源:CalendarView.cs

示例14: Style

 public HtmlAttributeManager Style(Style style)
 {
     style.AddAttributesToRender(Writer);
     return this;
 }
开发者ID:draizada,项目名称:IZWebFileManager,代码行数:5,代码来源:HtmlAttributeManager.cs

示例15: RenderHeader

        protected override void RenderHeader(HtmlTextWriter writer) {
            // Render title bar
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

            TitleStyle headerStyle = HeaderStyle;
            if (!headerStyle.IsEmpty) {
                // Apply font and forecolor from HeaderStyle to inner table
                Style style = new Style();
                if (!headerStyle.ForeColor.IsEmpty) {
                    style.ForeColor = headerStyle.ForeColor;
                }
                style.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty) {
                    // If the font size is specified on the HeaderStyle, force the font size to 100%,
                    // so it inherits the font size from its parent in IE compatibility mode. I would
                    // think that "1em" would work here as well, but "1em" doesn't work when you change
                    // the font size in the browser.
                    style.Font.Size = new FontUnit(new Unit(100, UnitType.Percentage));
                }
                if (!style.IsEmpty) {
                    style.AddAttributesToRender(writer, this);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Copied from Panel.cs
            // 
            HorizontalAlign hAlign = headerStyle.HorizontalAlign;
            if (hAlign != HorizontalAlign.NotSet) {
                TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign));
            }

            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(HeaderText);
            writer.RenderEndTag();  // Td

            WebPartVerb headerCloseVerb = HeaderCloseVerb;
            if (headerCloseVerb.Visible) {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                ZoneLinkButton closeButton = new ZoneLinkButton(this, headerCloseVerb.EventArgument);
                closeButton.Text = headerCloseVerb.Text;
                closeButton.ImageUrl = headerCloseVerb.ImageUrl;
                closeButton.ToolTip = headerCloseVerb.Description;
                closeButton.Enabled = headerCloseVerb.Enabled;
                closeButton.Page = Page;
                closeButton.ApplyStyle(HeaderVerbStyle);
                closeButton.RenderControl(writer);
                writer.RenderEndTag();  // Td
            }

            writer.RenderEndTag();  // Tr
            writer.RenderEndTag();  // Table
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:63,代码来源:ToolZone.cs


注:本文中的System.Web.UI.WebControls.Style.AddAttributesToRender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。