Share via


Html32TextWriter.RenderAfterContent Método

Definición

Escribe cualquier texto o espaciado que aparece después del contenido del elemento HTML.

protected:
 override System::String ^ RenderAfterContent();
protected override string RenderAfterContent ();
override this.RenderAfterContent : unit -> string
Protected Overrides Function RenderAfterContent () As String

Devoluciones

String

El espaciado o el texto que se va a escribir a continuación del contenido del elemento HTML; en caso contrario, si no hay tal información que representar, es null.

Ejemplos

En el ejemplo de código siguiente se muestra cómo invalidar el RenderAfterContent método . Cada método invalidado comprueba primero si se representa un th elemento y, a continuación, usa el SupportsBold método para comprobar si el dispositivo solicitante puede mostrar formato en negrita. Si el dispositivo admite formato de negrita, el RenderAfterContent método escribe la etiqueta de cierre de un b elemento. Si el dispositivo no admite formato de negrita, el RenderAfterContent método escribe la etiqueta de cierre de un font elemento.

A continuación, el código comprueba si se representa un h4 elemento y, a continuación, usa la SupportsItalic propiedad para comprobar si el dispositivo solicitante puede mostrar formato cursiva. Si el dispositivo admite formato cursiva, el RenderAfterContent método escribe la etiqueta de cierre de un i elemento. Si el dispositivo no admite el formato cursiva, el RenderAfterContent método escribe la etiqueta de cierre de un font elemento.

Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la Html32TextWriter clase .

// 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

Se aplica a

Consulte también