Html32TextWriter.RenderAfterContent Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Escreve qualquer texto ou espaçamento que apareça após o conteúdo do elemento HTML.
protected:
override System::String ^ RenderAfterContent();
protected override string RenderAfterContent();
override this.RenderAfterContent : unit -> string
Protected Overrides Function RenderAfterContent () As String
Devoluções
O espaçamento ou texto a escrever após o conteúdo do elemento HTML; caso contrário, se não houver tal informação para render, null.
Exemplos
O exemplo de código seguinte demonstra como sobrescrever o RenderAfterContent método. Cada método sobreposto verifica primeiro se um th elemento está a ser renderizado e depois usa o SupportsBold método para verificar se o dispositivo solicitante pode mostrar formatação a negrito. Se o dispositivo suportar formatação a negrito, o RenderAfterContent método escreve a etiqueta de fecho de um b elemento. Se o dispositivo não suportar formatação a negrito, o RenderAfterContent método escreve a etiqueta de fecho de um font elemento.
De seguida, o código verifica se um h4 elemento está a ser renderizado e usa a SupportsItalic propriedade para verificar se o dispositivo requerente pode apresentar formatação em itálico. Se o dispositivo suportar formatação itálica, o RenderAfterContent método escreve a etiqueta de fecho de um i elemento. Se o dispositivo não suportar formatação itálica, o RenderAfterContent método escreve a etiqueta de fecho de um font elemento.
Este exemplo de código faz parte de um exemplo maior fornecido para a Html32TextWriter classe.
// Override the RenderAfterContent method to close
// styles opened during the call to the RenderBeforeContent
// method.
protected override string RenderAfterContent()
{
// Check whether the element being rendered is a <th> element.
// If so, and the requesting device supports bold formatting,
// render the closing tag of the <b> element. If not,
// render the closing tag of the <font> element.
if (TagKey == HtmlTextWriterTag.Th)
{
if (SupportsBold)
return "</b>";
else
return "</font>";
}
// Check whether the element being rendered is an <H4>.
// element. If so, and the requesting device supports italic
// formatting, render the closing tag of the <i> element.
// If not, render the closing tag of the <font> element.
if (TagKey == HtmlTextWriterTag.H4)
{
if (SupportsItalic)
return "</i>";
else
return "</font>";
}
// Call the base method
return base.RenderAfterContent();
}
' Override the RenderAfterContent method to close
' styles opened during the call to the RenderBeforeContent
' method.
Protected Overrides Function RenderAfterContent() As String
' Check whether the element being rendered is a <th> element.
' If so, and the requesting device supports bold formatting,
' render the closing tag of the <b> element. If not,
' render the closing tag of the <font> element.
If TagKey = HtmlTextWriterTag.Th Then
If SupportsBold Then
Return "</b>"
Else
Return "</font>"
End If
End If
' Check whether the element being rendered is an <H4>.
' element. If so, and the requesting device supports italic
' formatting, render the closing tag of the <i> element.
' If not, render the closing tag of the <font> element.
If TagKey = HtmlTextWriterTag.H4 Then
If (SupportsItalic) Then
Return "</i>"
Else
Return "</font>"
End If
End If
' Call the base method.
Return MyBase.RenderAfterContent()
End Function