既定のタブ文字列を使用する HtmlTextWriter クラスの新しいインスタンスを初期化します。
名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Sub New ( _
writer As TextWriter _
)
'使用
Dim writer As TextWriter
Dim instance As New HtmlTextWriter(writer)
public HtmlTextWriter (
TextWriter writer
)
public:
HtmlTextWriter (
TextWriter^ writer
)
public HtmlTextWriter (
TextWriter writer
)
public function HtmlTextWriter (
writer : TextWriter
)
適用できません。
パラメータ
- writer
解説
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 Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter
DefaultTabString