本文整理汇总了VB.NET中System.Web.UI.HtmlTextWriter.GetStyleKey方法的典型用法代码示例。如果您正苦于以下问题:VB.NET HtmlTextWriter.GetStyleKey方法的具体用法?VB.NET HtmlTextWriter.GetStyleKey怎么用?VB.NET HtmlTextWriter.GetStyleKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.GetStyleKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: RenderBeginTag
' Override the RenderBeginTag method to check whether
' the tagKey parameter is set to a <label> element
' or a <font> element.
Public Overloads Overrides Sub RenderBeginTag(ByVal tagKey As HtmlTextWriterTag)
' If the tagKey parameter is set to a <label> element
' but a color attribute is not defined on the element,
' the AddStyleAttribute method adds a color attribute
' and sets it to red.
If tagKey = HtmlTextWriterTag.Label Then
If Not IsStyleAttributeDefined(HtmlTextWriterStyle.Color) Then
AddStyleAttribute(GetStyleKey("color"), "red")
End If
End If
' If the tagKey parameter is set to a <font> element
' but a size attribute is not defined on the element,
' the AddStyleAttribute method adds a size attribute
' and sets it to 30 point.
If tagKey = HtmlTextWriterTag.Font Then
If Not IsAttributeDefined(HtmlTextWriterAttribute.Size) Then
AddAttribute(GetAttributeKey("size"), "30pt")
End If
End If
' Call the base class's RenderBeginTag method
' to ensure that this custom MarkupTextWriter
' includes functionality for all other markup elements.
MyBase.RenderBeginTag(tagKey)
End Sub