本文整理匯總了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