HtmlTextWriter.Indent Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает количество позиций вкладок, отступ которых отступит в начале каждой строки разметки.
public:
property int Indent { int get(); void set(int value); };
public int Indent { get; set; }
member this.Indent : int with get, set
Public Property Indent As Integer
Значение свойства
Количество позиций вкладок для отступа каждой строки.
Примеры
В следующем примере кода показано, как увеличить значение, назначенное Indent свойству, когда атрибуты были добавлены в открывающий тег <span> элемента и RenderBeginTag метод был вызван. Это увеличивает отступ для любой разметки, отображаемой <span> внутри элемента.
// Set attributes and values along with attributes and styles
// attribute defined for a <span> element.
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('Hello');");
writer.AddAttribute("CustomAttribute", "CustomAttributeValue");
writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red");
writer.AddStyleAttribute("Customstyle", "CustomStyleValue");
writer.RenderBeginTag(HtmlTextWriterTag.Span);
// Create a space and indent the markup inside the
// <span> element.
writer.WriteLine();
writer.Indent++;
' Set attributes and values along with attributes and styles
' attribute defined for a <span> element.
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('Hello');")
writer.AddAttribute("CustomAttribute", "CustomAttributeValue")
writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red")
writer.AddStyleAttribute("CustomStyle", "CustomStyleValue")
writer.RenderBeginTag(HtmlTextWriterTag.Span)
' Create a space and indent the markup inside the
' <span> element.
writer.WriteLine()
writer.Indent += 1
Комментарии
Отступ выполняется путем записи строки, указанной tabStringHtmlTextWriter(TextWriter, String) параметром конструктора, количество раз, указанное свойством Indent .
Indent Если свойству присвоено отрицательное значение, оно изменяется на 0 перед сохранением.