TextBoxBase.AcceptsReturn TextBoxBase.AcceptsReturn TextBoxBase.AcceptsReturn TextBoxBase.AcceptsReturn Property

定义

获取或设置一个值,该值指示在用户按 ENTER 键时文本编辑控件如何响应。Gets or sets a value that indicates how the text editing control responds when the user presses the ENTER key.

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

属性值

如果按 Enter 键会在当前光标位置插入一个新行,则为 true;否则将忽略 Enter 键。true if pressing the ENTER key inserts a new line at the current cursor position; otherwise, the ENTER key is ignored. 对于 TextBox,默认值为 false;而对于 RichTextBox,默认值为 trueThe default value is false for TextBox and true for RichTextBox.

注解

ENTER 键对应VK_RETURN于虚拟键代码。The ENTER key corresponds to VK_RETURN virtual-key code.

依赖项属性信息Dependency Property Information

标识符字段Identifier field AcceptsReturnProperty
元数据属性设置为trueMetadata properties set to true NoneNone

适用于

另请参阅