HtmlTextWriter Oluşturucular

Tanım

HtmlTextWriter sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

Name Description
HtmlTextWriter(TextWriter)

Sınıfın varsayılan sekme dizesini HtmlTextWriter kullanan yeni bir örneğini başlatır.

HtmlTextWriter(TextWriter, String)

Belirtilen bir sekme dizesi karakteriyle sınıfın HtmlTextWriter yeni bir örneğini başlatır.

HtmlTextWriter(TextWriter)

Sınıfın varsayılan sekme dizesini HtmlTextWriter kullanan yeni bir örneğini başlatır.

public:
 HtmlTextWriter(System::IO::TextWriter ^ writer);
public HtmlTextWriter(System.IO.TextWriter writer);
new System.Web.UI.HtmlTextWriter : System.IO.TextWriter -> System.Web.UI.HtmlTextWriter
Public Sub New (writer As TextWriter)

Parametreler

writer
TextWriter

İşaretlemeyi TextWriter oluşturan örnek.

Örnekler

Aşağıdaki kod örneği, adlı HtmlTextWriter(TextWriter)özel HtmlTextWriter bir nesne oluşturmak için oluşturucunun StyledLabelHtmlWriter nasıl kullanılacağını gösterir. sınıfından MyPage türetilen Page özel sınıf bir istemci tarayıcısı tarafından istendiğinde, çıkış akışına içeriğini işlemek için sınıfını kullanır StyledLabelHtmlWriter .

// A custom class that overrides its CreateHtmlTextWriter method.
// This page uses the StyledLabelHtmlWriter class to render its content.
public ref class MyPage: public Page
{
protected:
   virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override
   {
      return gcnew HtmlStyledLabelWriter( writer );
   }
};

// A custom class that overrides its CreateHtmlTextWriter method.
// This page uses the HtmlStyledLabelWriter class to render its content.
[AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
public class MyPage : Page
{
    protected override HtmlTextWriter CreateHtmlTextWriter(TextWriter writer)
    {
        return new HtmlStyledLabelWriter(writer);
    }
}
' A custom class that overrides the CreateHtmlTextWriter method.
' This page uses the StyledLabelHtmlWriter to render its content.  
<AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class MyPage
    Inherits Page

    Protected Overrides Function CreateHtmlTextWriter(ByVal writer As TextWriter) As HtmlTextWriter
        Return New HtmlStyledLabelWriter(writer)
    End Function 'CreateHtmlTextWriter
End Class

Açıklamalar

Oluşturucunun HtmlTextWriterHtmlTextWriter(TextWriter) aşırı yüklemesi, bir satır girintisi gerektiğinde sabitini kullanır DefaultTabString . Yeni örneği başlatmak için aşırı yüklemeyi çağırır HtmlTextWriter(TextWriter, String) .

Ayrıca bkz.

Şunlara uygulanır

HtmlTextWriter(TextWriter, String)

Belirtilen bir sekme dizesi karakteriyle sınıfın HtmlTextWriter yeni bir örneğini başlatır.

public:
 HtmlTextWriter(System::IO::TextWriter ^ writer, System::String ^ tabString);
public HtmlTextWriter(System.IO.TextWriter writer, string tabString);
new System.Web.UI.HtmlTextWriter : System.IO.TextWriter * string -> System.Web.UI.HtmlTextWriter
Public Sub New (writer As TextWriter, tabString As String)

Parametreler

writer
TextWriter

TextWriter İşaretlemeyi oluşturan içerik.

tabString
String

Satır girintisini işlemek için kullanılacak dize.

Örnekler

Aşağıdaki kod örneği, adlı HtmlTextWriter(TextWriter)özel HtmlTextWriter bir nesne oluşturmak için oluşturucunun StyledLabelHtmlWriter nasıl kullanılacağını gösterir. sınıfından MyPage türetilen Page özel sınıf bir istemci tarayıcısı tarafından istendiğinde, çıkış akışına içeriğini işlemek için sınıfını kullanır StyledLabelHtmlWriter .

// A custom class that overrides its CreateHtmlTextWriter method.
// This page uses the StyledLabelHtmlWriter class to render its content.
public ref class MyPage: public Page
{
protected:
   virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override
   {
      return gcnew HtmlStyledLabelWriter( writer );
   }
};

// A custom class that overrides its CreateHtmlTextWriter method.
// This page uses the HtmlStyledLabelWriter class to render its content.
[AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
public class MyPage : Page
{
    protected override HtmlTextWriter CreateHtmlTextWriter(TextWriter writer)
    {
        return new HtmlStyledLabelWriter(writer);
    }
}
' A custom class that overrides the CreateHtmlTextWriter method.
' This page uses the StyledLabelHtmlWriter to render its content.  
<AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class MyPage
    Inherits Page

    Protected Overrides Function CreateHtmlTextWriter(ByVal writer As TextWriter) As HtmlTextWriter
        Return New HtmlStyledLabelWriter(writer)
    End Function 'CreateHtmlTextWriter
End Class

Açıklamalar

Bir HtmlTextWriter satır girintisi HtmlTextWriter(TextWriter, String) gerektiğinde oluşturucunun aşırı yüklemesi kullanır tabString . Yeni örneği başlatmak için temel oluşturucuyu çağırır TextWriter.TextWriter(IFormatProvider) .

Ayrıca bkz.

Şunlara uygulanır