TextBox.AcceptsReturn Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Beolvas vagy beállít egy értéket, amely jelzi, hogy az ENTER billentyű lenyomása többsoros TextBox vezérlőelemben új szövegsort hoz-e létre a vezérlőben, vagy aktiválja-e az űrlap alapértelmezett gombját.
public:
property bool AcceptsReturn { bool get(); void set(bool value); };
public bool AcceptsReturn { get; set; }
member this.AcceptsReturn : bool with get, set
Public Property AcceptsReturn As Boolean
Tulajdonság értéke
true ha az ENTER-kulcs új szövegsort hoz létre a vezérlő többsoros verziójában; false ha az ENTER billentyű aktiválja az űrlap alapértelmezett gombját. Az alapértelmezett érték a false.
Példák
Az alábbi példakód egy többsoros TextBox vezérlőt hoz létre függőleges görgetősávokkal. Ez a példa a AcceptsTab, AcceptsReturnés WordWrap a tulajdonságok használatával teszi hasznossá a többsoros szövegdoboz-vezérlőt a szövegdokumentumok létrehozásához.
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 to be entered 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!";
}
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 to be entered 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!";
}
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 to be entered 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!"
End Sub
Megjegyzések
Ha ennek a tulajdonságnak az értéke, falsea felhasználónak a CTRL+ENTER billentyűkombinációt lenyomva új sort kell létrehoznia egy többsoros TextBox vezérlőelemben. Ha nincs alapértelmezett gomb az űrlaphoz, az ENTER billentyű mindig létrehoz egy új szövegsort a vezérlőben, függetlenül a tulajdonság értékétől.