HtmlTextWriter.OutputTabs 方法

定義

寫入一系列的定位字串,表示一行的標記字元的縮排層次。

protected:
 virtual void OutputTabs();
protected virtual void OutputTabs ();
abstract member OutputTabs : unit -> unit
override this.OutputTabs : unit -> unit
Protected Overridable Sub OutputTabs ()

範例

下列程式碼範例示範如何在衍生自 類別的 HtmlTextWriter 類別中覆寫 OutputTabs 方法。 覆 OutputTabs 寫一律會使用 DefaultTabString 常數來執行縮排。

// Override the OutputTabs method to set the tab to
// the number of spaces defined by the Indent variable.
virtual void OutputTabs() override
{
   
   // Output the DefaultTabString for the number
   // of times specified in the Indent property.
   for ( int i = 0; i < Indent; i++ )
      Write( DefaultTabString );
   __super::OutputTabs();
}
// Override the OutputTabs method to set the tab to
// the number of spaces defined by the Indent variable.      
protected override void OutputTabs()
{
    // Output the DefaultTabString for the number
    // of times specified in the Indent property.
    for (int i = 0; i < Indent; i++)
        Write(DefaultTabString);
    base.OutputTabs();
}
' Override the OutputTabs method to set the tab to
' the number of spaces defined by the Indent variable.   
Protected Overrides Sub OutputTabs()
    ' Output the DefaultTabString for the number
    ' of times specified in the Indent property.
    Dim i As Integer
    For i = 0 To Indent - 1
        Write(DefaultTabString)
    Next i
    MyBase.OutputTabs()
End Sub

備註

方法 OutputTabsIndent 使用 屬性來判斷要寫入的索引標籤字串數目,以取得所需的縮排。

索引標籤字串是使用 建構函式來 HtmlTextWriter 指定。 如果未指定索引標籤字串, DefaultTabString 則會使用常數 (\t) 。

適用於

另請參閱