HtmlTextWriter.NewLine プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As HtmlTextWriter Dim value As String value = instance.NewLine instance.NewLine = value
public: virtual property String^ NewLine { String^ get () override; void set (String^ value) override; }
/** @property */ public String get_NewLine () /** @property */ public void set_NewLine (String value)
public override function get NewLine () : String public override function set NewLine (value : String)
現在の HtmlTextWriter で使用される行終端文字列。

既定の行終端文字列は、復帰の次にライン フィードが付いた形です ("\r\n")。
行終端文字列は、WriteLine メソッドの 1 つを呼び出すたびに、出力ストリームに書き込まれます。NewLine プロパティが null 参照 (Visual Basic では Nothing) に設定されている場合は、既定の改行文字が使用されます。

FilterAttributes メソッドをオーバーライドする HtmlTextWriter クラスから派生したカスタム クラスを使用する方法を次のコード例に示します。FilterAttributes オーバーライドが呼び出されると、テキスト ライタによって <label> 要素または <a> 要素が出力されるかどうかがチェックされます。出力される場合、FilterAttributes メソッドによって、ラベルにスタイル属性が定義されているかどうかがチェックされます。スタイルが定義されていない場合は、FilterAttributes メソッドによって、style:color 属性の既定値に blue が設定されます。次に、FilterAttributes メソッドが NewLine プロパティを使用して、マークアップ タグに改行を挿入し、その他の定義済み属性を出力します。
' Override the FilterAttributes method to check whether ' <label> and <anchor> elements contain specific attributes. Protected Overrides Sub FilterAttributes() ' If the <label> element is rendered and a style ' attribute is not defined, add a style attribute ' and set its value to blue. If TagKey = HtmlTextWriterTag.Label Then If Not IsAttributeDefined(HtmlTextWriterAttribute.Style) Then AddAttribute("style", EncodeAttributeValue("color:blue", True)) Write(NewLine) Indent = 3 OutputTabs() End If End If ' If an <anchor> element is rendered and an href ' attribute has not been defined, call the AddAttribute ' method to add an href attribute ' and set it to http://www.cohowinery.com. ' Use the EncodeUrl method to convert any spaces to %20. If TagKey = HtmlTextWriterTag.A Then If Not IsAttributeDefined(HtmlTextWriterAttribute.Href) Then AddAttribute("href", EncodeUrl("http://www.cohowinery.com")) End If End If ' Call the FilterAttributes method of the base class. MyBase.FilterAttributes() End Sub
// Override the FilterAttributes method to check whether // <label> and <anchor> elements contain specific attributes. protected override void FilterAttributes() { // If the <label> element is rendered and a style // attribute is not defined, add a style attribute // and set its value to blue. if (TagKey == HtmlTextWriterTag.Label) { if (!IsAttributeDefined(HtmlTextWriterAttribute.Style)) { AddAttribute("style", EncodeAttributeValue("color:blue" , true)); Write(NewLine); Indent = 3; OutputTabs(); } } // If an <anchor> element is rendered and an href // attribute has not been defined, call the AddAttribute // method to add an href attribute // and set it to http://www.cohowinery.com. // Use the EncodeUrl method to convert any spaces to %20. if (TagKey == HtmlTextWriterTag.A) { if (!IsAttributeDefined(HtmlTextWriterAttribute.Href)) { AddAttribute("href", EncodeUrl("http://www.cohowinery.com")); } } // Call the FilterAttributes method of the base class. base.FilterAttributes(); }
// Override the FilterAttributes method to check whether // <label> and <anchor> elements contain specific attributes. virtual void FilterAttributes() override { // If the <label> element is rendered and a style // attribute is not defined, add a style attribute // and set its value to blue. if ( TagKey == HtmlTextWriterTag::Label ) { if ( !IsAttributeDefined( HtmlTextWriterAttribute::Style ) ) { AddAttribute( "style", EncodeAttributeValue( "color:blue", true ) ); Write( NewLine ); Indent = 3; OutputTabs(); } } // If an <anchor> element is rendered and an href // attribute has not been defined, call the AddAttribute // method to add an href attribute // and set it to http://www.cohowinery.com. // Use the EncodeUrl method to convert any spaces to %20. if ( TagKey == HtmlTextWriterTag::A ) { if ( !IsAttributeDefined( HtmlTextWriterAttribute::Href ) ) { AddAttribute( "href", EncodeUrl( "http://www.cohowinery.com" ) ); } } // Call the FilterAttributes method of the base class. __super::FilterAttributes(); }
// Override the FilterAttributes method to check whether // <label> and <anchor> elements contain specific attributes. protected void FilterAttributes() { // If the Label tag is being rendered and a style // attribute is not defined, add a style attribute // and set its value to blue. if (get_TagKey().Equals(HtmlTextWriterTag.Label)) { if (!(IsAttributeDefined(HtmlTextWriterAttribute.Style))) { AddAttribute("style", EncodeAttributeValue("color:blue" , true)); Write(get_NewLine()); set_Indent(3); OutputTabs(); } } // If an Anchor element is being rendered and an href // attribute has not been defined, call the AddAttribute // method to add an href // attribute and set it to http://www.cohowinery.com. // Use the EncodeUrl method to convert any spaces to %20. if (get_TagKey().Equals(HtmlTextWriterTag.A)) { if (!(IsAttributeDefined(HtmlTextWriterAttribute.Href))) { AddAttribute("href", EncodeUrl("http://www.cohowinery.com")); } } // Call the FilterAttributes method of the base class. super.FilterAttributes(); } //FilterAttributes

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlTextWriter.NewLine プロパティを検索する場合は、下記のリンクをクリックしてください。

- HtmlTextWriter.NewLine プロパティのページへのリンク