HtmlTextWriter.Indent Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece el número de posiciones de tabulación para sangr el principio de cada línea de marcado.
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
Valor de propiedad
Número de posiciones de tabulación para sangr cada línea.
Ejemplos
En el ejemplo de código siguiente se muestra cómo incrementar el valor asignado a la Indent propiedad cuando se han agregado atributos a la etiqueta de apertura de un <span> elemento y se ha llamado al RenderBeginTag método . Esto aumenta la sangría para cualquier marcado que se represente dentro del <span> elemento.
// 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
Comentarios
La sangría se realiza escribiendo la cadena especificada por el tabString parámetro del HtmlTextWriter(TextWriter, String) constructor el número de veces especificadas por la Indent propiedad .
Si la Indent propiedad se establece en un valor negativo, se cambia a 0 antes de guardarse.