本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}