TextBoxBase.AcceptsTab Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает значение, указывающее, вводит ли клавиша TAB в многострочного элемента управления символ TAB в элементе управления вместо перемещения фокуса на следующий элемент управления в порядке табуляции.
public:
property bool AcceptsTab { bool get(); void set(bool value); };
public bool AcceptsTab { get; set; }
member this.AcceptsTab : bool with get, set
Public Property AcceptsTab As Boolean
Значение свойства
true Если пользователи могут вводить вкладки в многострочного текстового поля с помощью клавиши TAB; false При нажатии клавиши TAB фокус перемещается. Значение по умолчанию — false.
Примеры
В следующем примере кода используется TextBoxпроизводный класс для создания многостроного TextBox элемента управления с вертикальными полосами прокрутки. В этом примере также используются AcceptsTabAcceptsReturnсвойства и WordWrap свойства для создания текстовых документов с несколькими строками.
public:
void CreateMyMultilineTextBox()
{
// Create an instance of a TextBox control.
TextBox^ textBox1 = gcnew TextBox;
// Set the Multiline property to true.
textBox1->Multiline = true;
// Add vertical scroll bars to the TextBox control.
textBox1->ScrollBars = ScrollBars::Vertical;
// Allow the RETURN key in the TextBox control.
textBox1->AcceptsReturn = true;
// Allow the TAB key to be entered in the TextBox control.
textBox1->AcceptsTab = true;
// Set WordWrap to true to allow text to wrap to the next line.
textBox1->WordWrap = true;
// Set the default text of the control.
textBox1->Text = "Welcome!" + Environment::NewLine + "Second Line";
}
public void CreateMyMultilineTextBox()
{
// Create an instance of a TextBox control.
TextBox textBox1 = new TextBox();
// Set the Multiline property to true.
textBox1.Multiline = true;
// Add vertical scroll bars to the TextBox control.
textBox1.ScrollBars = ScrollBars.Vertical;
// Allow the RETURN key in the TextBox control.
textBox1.AcceptsReturn = true;
// Allow the TAB key to be entered in the TextBox control.
textBox1.AcceptsTab = true;
// Set WordWrap to true to allow text to wrap to the next line.
textBox1.WordWrap = true;
// Set the default text of the control.
textBox1.Text = "Welcome!" + Environment.NewLine + "Second Line";
}
Public Sub CreateMyMultilineTextBox()
' Create an instance of a TextBox control.
Dim textBox1 As New TextBox()
' Set the Multiline property to true.
textBox1.Multiline = True
' Add vertical scroll bars to the TextBox control.
textBox1.ScrollBars = ScrollBars.Vertical
' Allow the RETURN key in the TextBox control.
textBox1.AcceptsReturn = True
' Allow the TAB key to be entered in the TextBox control.
textBox1.AcceptsTab = True
' Set WordWrap to true to allow text to wrap to the next line.
textBox1.WordWrap = True
' Set the default text of the control.
textBox1.Text = "Welcome!" & Environment.NewLine & "Second Line"
End Sub
Комментарии
Свойство Multiline также должно быть true для получения символа TAB в элементе управления.
AcceptsTab Если для свойства задано trueзначение, пользователь должен нажать клавиши CTRL+TAB, чтобы переместить фокус на следующий элемент управления в порядке табуляции.