TextBox.AcceptsReturn Özellik

Tanım

Çok satırlı TextBox bir denetimde ENTER tuşuna basıldığında denetimde yeni bir metin satırı oluşturulup oluşturulmayacağını veya form için varsayılan düğmenin etkinleştirildiğini belirten bir değer alır veya ayarlar.

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

Özellik Değeri

true ENTER tuşu denetimin çok satırlı bir sürümünde yeni bir metin satırı oluşturuyorsa; false ENTER tuşu form için varsayılan düğmeyi etkinleştirirse. Varsayılan değer: false.

Örnekler

Aşağıdaki kod örneği, dikey kaydırma çubuklarıyla çok satırlı TextBox bir denetim oluşturur. Bu örnekte, çok satırlı metin kutusu denetiminin metin belgeleri oluşturmak için kullanışlı olması için , AcceptsTabve AcceptsReturn özellikleri kullanılırWordWrap.

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

Açıklamalar

Bu özelliğin değeri ise false, kullanıcının çok satırlı TextBox denetimde yeni bir satır oluşturmak için CTRL+ENTER tuşlarına basması gerekir. Form için varsayılan düğme yoksa, ENTER tuşu bu özelliğin değerinden bağımsız olarak denetimde her zaman yeni bir metin satırı oluşturur.

Şunlara uygulanır