HtmlTextWriter コンストラクタ (TextWriter)
アセンブリ: System.Web (system.web.dll 内)

Public Sub New ( _ writer As TextWriter _ )
public HtmlTextWriter ( TextWriter writer )
public: HtmlTextWriter ( TextWriter^ writer )
public HtmlTextWriter ( TextWriter writer )
public function HtmlTextWriter ( writer : TextWriter )

HtmlTextWriter(TextWriter) コンストラクタの HtmlTextWriter オーバーロードは、行のインデントが必要な場合に DefaultTabString 定数を使用します。これにより、HtmlTextWriter(TextWriter,String) オーバーロードが呼び出され、新しいインスタンスが初期化されます。

HtmlTextWriter(TextWriter) コンストラクタを使用して、StyledLabelHtmlWriter という名前のカスタム HtmlTextWriter オブジェクトを作成する方法を次のコード例に示します。Page クラスから派生した MyPage カスタム クラスがクライアント ブラウザによって要求されると、StyledLabelHtmlWriter クラスを使用して、出力ストリームに内容が出力されます。
' 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 'MyPage
// 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 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. public class MyPage extends Page { protected HtmlTextWriter CreateHtmlTextWriter(TextWriter writer) { return new HtmlStyledLabelWriter(writer); } //CreateHtmlTextWriter } //MyPage

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HtmlTextWriter コンストラクタ

名前 | 説明 |
---|---|
HtmlTextWriter (TextWriter) | 既定のタブ文字列を使用する HtmlTextWriter クラスの新しいインスタンスを初期化します。 |
HtmlTextWriter (TextWriter, String) | タブ文字列を指定して、HtmlTextWriter クラスの新しいインスタンスを初期化します。 |

HtmlTextWriter コンストラクタ (TextWriter, String)
アセンブリ: System.Web (system.web.dll 内)

Dim writer As TextWriter Dim tabString As String Dim instance As New HtmlTextWriter(writer, tabString)
public HtmlTextWriter ( TextWriter writer, string tabString )
public: HtmlTextWriter ( TextWriter^ writer, String^ tabString )
public HtmlTextWriter ( TextWriter writer, String tabString )

HtmlTextWriter(TextWriter,String) コンストラクタの HtmlTextWriter オーバーロードは、行のインデントが必要な場合に tabString を使用します。これにより、System.IO.TextWriter 基本コンストラクタが呼び出され、新しいインスタンスが初期化されます。

HtmlTextWriter(TextWriter) コンストラクタを使用して、StyledLabelHtmlWriter という名前のカスタム HtmlTextWriter オブジェクトを作成する方法を次のコード例に示します。Page クラスから派生した MyPage カスタム クラスがクライアント ブラウザによって要求されると、StyledLabelHtmlWriter クラスを使用して、出力ストリームに内容が出力されます。
' 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 'MyPage
// 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 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. public class MyPage extends Page { protected HtmlTextWriter CreateHtmlTextWriter(TextWriter writer) { return new HtmlStyledLabelWriter(writer); } //CreateHtmlTextWriter } //MyPage

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- HtmlTextWriter コンストラクタのページへのリンク