Html32TextWriter.SupportsItalic Property
Gets or sets a Boolean value indicating whether the requesting device supports italic HTML text. Use the SupportsItalic property to conditionally render italicized text to the Html32TextWriter output stream.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System.Booleantrue if the requesting device supports italic text; otherwise, false. The default is true.
The following code example demonstrates how to override the RenderBeforeContent and RenderAfterContent methods. Each override checks whether a span element is being rendered, and then uses the SupportsItalic property to check whether the requesting device can display italic formatting. If the device supports italic formatting, the RenderBeforeContent method writes the opening tag of an i element and the RenderAfterContent method writes its closing tag. If the device does not support italic formatting, the RenderBeforeContent method writes the opening tag of a Font element with a color attribute set to the hexadecimal value for navy blue, and the RenderAfterContent method writes the closing tag.
This code example is part of a larger example provided for the Html32TextWriter class.
' Override the RenderBeforeContent method to render ' styles before rendering the content of a <th> element. Protected Overrides Function RenderBeforeContent() As String ' Check the TagKey property. If its value is ' HtmlTextWriterTag.TH, check the value of the ' SupportsBold property. If true, return the ' opening tag of a <b> element; otherwise, render ' the opening tag of a <font> element with a color ' attribute set to the hexadecimal value for red. If TagKey = HtmlTextWriterTag.Th Then If (SupportsBold) Then Return "<b>" Else Return "<font color=""FF0000"">" End If End If ' Check whether the element being rendered ' is an <H4> element. If it is, check the ' value of the SupportsItalic property. ' If true, render the opening tag of the <i> element ' prior to the <H4> element's content; otherwise, ' render the opening tag of a <font> element ' with a color attribute set to the hexadecimal ' value for navy blue. If TagKey = HtmlTextWriterTag.H4 Then If (SupportsItalic) Then Return "<i>" Else Return "<font color=""000080"">" End If End If ' Call the base method. Return MyBase.RenderBeforeContent() End Function
Available since 2.0