ToolStripTextBox.TextBoxTextAlign ToolStripTextBox.TextBoxTextAlign ToolStripTextBox.TextBoxTextAlign ToolStripTextBox.TextBoxTextAlign Property

Definición

Obtiene o establece cómo se alinea el texto en un control TextBox.Gets or sets how text is aligned in a TextBox control.

public:
 property System::Windows::Forms::HorizontalAlignment TextBoxTextAlign { System::Windows::Forms::HorizontalAlignment get(); void set(System::Windows::Forms::HorizontalAlignment value); };
public System.Windows.Forms.HorizontalAlignment TextBoxTextAlign { get; set; }
member this.TextBoxTextAlign : System.Windows.Forms.HorizontalAlignment with get, set
Public Property TextBoxTextAlign As HorizontalAlignment

Valor de propiedad

Uno de los valores de enumeración de HorizontalAlignment que especifica cómo se alinea el texto en el control.One of the HorizontalAlignment enumeration values that specifies how text is aligned in the control. De manera predeterminada, es Left.The default is Left.

Ejemplos

En el ejemplo de código siguiente se muestra la sintaxis ToolStripTextBox para establecer diversos valores de propiedades TextBoxTextAlign comunes, incluida la propiedad.The following code example demonstrates the syntax for setting various ToolStripTextBox common property settings, including the TextBoxTextAlign property .

// This code example demonstrates the syntax for setting
// various ToolStripTextBox properties.
// 
toolStripTextBox1.AcceptsReturn = true;
toolStripTextBox1.AcceptsTab = true;
toolStripTextBox1.AutoCompleteCustomSource.AddRange(new string[] {
"This is line one.",
"Second line.",
"Another line."});
toolStripTextBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
toolStripTextBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
toolStripTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
toolStripTextBox1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
toolStripTextBox1.HideSelection = false;
toolStripTextBox1.MaxLength = 32000;
toolStripTextBox1.Name = "toolStripTextBox1";
toolStripTextBox1.ShortcutsEnabled = false;
toolStripTextBox1.Size = new System.Drawing.Size(100, 25);
toolStripTextBox1.Text = "STRING1\r\nSTRING2\r\nSTRING3\r\nSTRING4";
toolStripTextBox1.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center;
' This code example demonstrates the syntax for setting
' various ToolStripTextBox properties.
' 
toolStripTextBox1.AcceptsReturn = True
toolStripTextBox1.AcceptsTab = True
toolStripTextBox1.AutoCompleteCustomSource.AddRange(New String() {"This is line one.", "Second line.", "Another line."})
toolStripTextBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend
toolStripTextBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource
toolStripTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
toolStripTextBox1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
toolStripTextBox1.HideSelection = False
toolStripTextBox1.MaxLength = 32000
toolStripTextBox1.Name = "toolStripTextBox1"
toolStripTextBox1.ShortcutsEnabled = False
toolStripTextBox1.Size = New System.Drawing.Size(100, 25)
toolStripTextBox1.Text = "STRING1" + ControlChars.Cr + ControlChars.Lf + "STRING2" + ControlChars.Cr + ControlChars.Lf + "STRING3" + ControlChars.Cr + ControlChars.Lf + "STRING4"
toolStripTextBox1.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center

Comentarios

Puede usar esta propiedad para alinear el texto dentro de TextBox un para que coincida con el diseño de texto del formulario.You can use this property to align the text within a TextBox to match the layout of text on your form. Por ejemplo, si todos los controles se encuentran en el lado derecho del formulario, puede establecer la TextBoxTextAlign propiedad en Righty el texto se alineará con el lado derecho del control en lugar de la alineación izquierda predeterminada.For example, if your controls are all located on the right side of the form, you can set the TextBoxTextAlign property to Right, and the text will be aligned with the right side of the control instead of the default left alignment.

Se aplica a