當前位置: 首頁>>代碼示例>>C#>>正文


C# Style.AddCssClass方法代碼示例

本文整理匯總了C#中System.Web.UI.WebControls.Style.AddCssClass方法的典型用法代碼示例。如果您正苦於以下問題:C# Style.AddCssClass方法的具體用法?C# Style.AddCssClass怎麽用?C# Style.AddCssClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.UI.WebControls.Style的用法示例。


在下文中一共展示了Style.AddCssClass方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddCssClass

		public void AddCssClass (Style style, string cssClass)
		{
			style.AddCssClass (cssClass);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:4,代碼來源:BaseMenuRenderer.cs

示例2: RegisterStyle

		void RegisterStyle (Style baseStyle, Style linkStyle)
		{
			linkStyle.CopyTextStylesFrom (baseStyle);
			linkStyle.BorderStyle = BorderStyle.None;
			linkStyle.AddCssClass (baseStyle.CssClass);
			baseStyle.Font.Reset ();
			RegisterStyle (linkStyle);
			RegisterStyle (baseStyle);
		}
開發者ID:tgiphil,項目名稱:mono,代碼行數:9,代碼來源:TreeView.cs

示例3: 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

示例4: 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


注:本文中的System.Web.UI.WebControls.Style.AddCssClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。