HtmlTextWriter.OutputTabs 方法

定義

寫入一系列的定位字串,表示一行的標記字元的縮排層次。Writes a series of tab strings that represent the indentation level for a line of markup characters.

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

範例

下列程式碼範例示範如何在衍生OutputTabs HtmlTextWriter自類別的類別中覆寫方法。The following code example shows how to override the OutputTabs method in a class that is derived from the HtmlTextWriter class. 覆寫一律會使用常數來執行縮排。 DefaultTabString OutputTabsThe OutputTabs override always uses the DefaultTabString constant to perform the indentation.

// 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

備註

OutputTabs方法會Indent使用屬性來判斷要寫入多少個索引標籤字串,以取得所需的縮排。The OutputTabs method uses the Indent property to determine how many tab strings to write to obtain the desired indentation.

索引標籤字串會使用此HtmlTextWriter函式來指定。The tab string is specified with the HtmlTextWriter constructor. 如果未指定任何索引標籤字串DefaultTabString ,則\t會使用常數()。If no tab string is specified, the DefaultTabString constant (\t) is used.

適用於

另請參閱