Share via


Html32TextWriter.RenderBeforeTag Méthode

Définition

Écrit le texte ou l’espacement qui se trouvent avant la balise d’ouverture de l’élément HTML dans le flux de sortie HTML 3.2.

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

Retours

String

Informations HTML sur les polices et l'espacement à rendre avant la balise ; sinon, s'il n'existe aucune information de la sorte à rendre, null.

Exemples

L’exemple de code suivant montre comment remplacer la RenderBeforeTag méthode. Le code vérifie si un a élément est rendu. Si tel est le cas, la méthode remplacée RenderBeforeTag écrit la balise d’ouverture d’un small élément. L’exemple de l’élément RenderAfterTag effectue la même vérification pour l’élément a , puis écrit la balise de fermeture de l’élément small .

Cet exemple de code fait partie d’un exemple plus grand fourni pour la Html32TextWriter classe.

// Override the RenderBeforeTag method to render the
// opening tag of a <small> element to modify the text size of 
// any <a> elements that this writer encounters.
protected override string RenderBeforeTag()
{
    // Check whether the element being rendered is an 
    // <a> element. If so, render the opening tag
    // of the <small> element; otherwise, call the base method.
    if (TagKey == HtmlTextWriterTag.A)
        return "<small>";
    return base.RenderBeforeTag();
}
' Override the RenderBeforeTag method to render the
' opening tag of a <small> element to modify the text size of 
' any <a> elements that this writer encounters.
Protected Overrides Function RenderBeforeTag() As String
    ' Check whether the element being rendered is an 
    ' <a> element. If so, render the opening tag
    ' of the <small> element; otherwise, call the base method.
    If TagKey = HtmlTextWriterTag.A Then
        Return "<small>"
    End If
    Return MyBase.RenderBeforeTag()
End Function

S’applique à

Voir aussi