textBox multiline
来源:互联网 发布:php基础知识总结 编辑:程序博客网 时间:2024/04/29 19:43
获取或设置一个值,该值指示在多行文本框控件中按 TAB 键时,是否在控件中键入一个 TAB 字符,而不是按选项卡的顺序将焦点移动到下一个控件。
[Visual Basic]Public Property AcceptsTab As Boolean
[C#]public bool AcceptsTab {get; set;}
[C++]public: __property bool get_AcceptsTab();public: __property void set_AcceptsTab(bool);
[JScript]public function get AcceptsTab() : Boolean;public function set AcceptsTab(Boolean);
属性值
如果用户可以使用 TAB 键在多行文本框控件中输入 TAB 字符,则为 true;如果按 TAB 键移动焦点,则为 false。默认为 false。
备注
如果将 AcceptsTab 属性设置为 true,则用户必须按 CTRL+TAB 键将焦点移动到 Tab 键顺序中的下一个控件。
示例
[Visual Basic, C#] 以下示例使用派生类 TextBox 来创建一个带垂直滚动条的多行 TextBox 控件。此示例还使用 AcceptsTab、AcceptsReturn 和 WordWrap 属性来使多行文本框控件可用于创建文本文档。
[Visual Basic] 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!"End Sub
[C#] 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!"; }
[C++, JScript] 没有可用于 C++ 或 JScript 的示例。若要查看 Visual Basic 或 C# 示例,请单击页左上角的“语言筛选器”按钮 。
要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Framework 精简版 - Windows CE .NET
请参见
TextBoxBase 类 | TextBoxBase 成员 | System.Windows.Forms 命名空间 | AcceptsReturn
获取或设置一个值,该值指示在多行 TextBox 控件中按 ENTER 键时,是在控件中创建一行新文本还是激活窗体的默认按钮。
[Visual Basic]Public Property AcceptsReturn As Boolean
[C#]public bool AcceptsReturn {get; set;}
[C++]public: __property bool get_AcceptsReturn();public: __property void set_AcceptsReturn(bool);
[JScript]public function get AcceptsReturn() : Boolean;public function set AcceptsReturn(Boolean);
属性值
如果按 ENTER 键时在多行版本的控件中创建一行新文本,则为 true;如果按 ENTER 键时激活窗体的默认按钮,则为 false。默认为 false。
备注
如果此属性的值为 false,则用户必须按 CTRL+ENTER 键才能在多行 TextBox 控件中创建一个新行。如果该窗体没有默认按钮,则按 ENTER 键时将总是会在控件中创建一行新文本,不管该属性的值是什么。
.NET Framework 精简版 - Windows CE .NET 平台说明: 虽然可将 AcceptsReturn 设置成 false,但它始终与设置成 true 一样运行。如果希望使用 ENTER 键激活特殊的按钮,可从 TextBox 派生一个类,并在发生 KeyPress 事件时为 ENTER 键提供事件处理代码。
示例
[Visual Basic, C#, JScript] 以下示例创建一个带垂直滚动条的多行 TextBox 控件。此示例使用 AcceptsTab、AcceptsReturn 和 WordWrap 属性来使多行文本框控件可用于创建文本文档。
[Visual Basic] 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
[C#] 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!"; }
[JScript] public function CreateMyMultilineTextBox() { // Create an instance of a TextBox control. 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!"; }
[C++] 没有可用于 C++ 的示例。若要查看 Visual Basic、C# 或 JScript 示例,请单击页左上角的“语言筛选器”按钮 。
要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Framework 精简版 - Windows CE .NET
请参见
TextBox 类 | TextBox 成员 | System.Windows.Forms 命名空间
指示多行文本框控件在必要时是否自动换行到下一行的开始。
[Visual Basic]Public Property WordWrap As Boolean
[C#]public bool WordWrap {get; set;}
[C++]public: __property bool get_WordWrap();public: __property void set_WordWrap(bool);
[JScript]public function get WordWrap() : Boolean;public function set WordWrap(Boolean);
属性值
如果多行文本框控件可换行,则为 true;如果当用户键入的内容超过了控件的右边缘时,文本框控件自动水平滚动,则为 false。默认为 true。
备注
如果此属性设置为 true,则不管 ScrollBars 属性的设置是什么,都不会显示水平滚动条。
注意 在派生类 TextBox 中,不管此属性的属性设置是什么,控件中的文本将总是换行,除非将 TextAlign 属性设置为 HorizontalAlignment.Left。
示例
[Visual Basic, C#] 以下示例使用派生类 TextBox 来创建一个带垂直滚动条的多行 TextBox 控件。此示例还使用 AcceptsTab、AcceptsReturn 和 WordWrap 属性来使多行文本框控件可用于创建文本文档。
[Visual Basic] 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!"End Sub
[C#] 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!"; }
[C++, JScript] 没有可用于 C++ 或 JScript 的示例。若要查看 Visual Basic 或 C# 示例,请单击页左上角的“语言筛选器”按钮 。
要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Framework 精简版 - Windows CE .NET
请参见
TextBoxBase 类 | TextBoxBase 成员 | System.Windows.Forms 命名空间
- textBox multiline
- TextBox 的 MultiLine 换行
- easyui Multiline TextBox 获取值
- multiline的TextBox的长度限制
- TextBox设置为MultiLine限制字数问题。
- Let Textbox support Maxlength when in Multiline mode
- TextBox 在 MultiLine 模式时无法使用 MaxLength 属性
- TextBox 在TextMode为"MultiLine"时怎样控制输入长度。
- textbox的textmode取为multiline时,其maxlength不起作用
- 在multiline模式下限制textbox 的长度
- char limit validation in multiline asp.net textbox
- asp:TextBox multiline 只读条件下的高度问题
- textbox的textmode取为multiline时,其maxlength不起作用 解决方法
- textbox在MultiLine的情况下控制长度和行数问题
- 关于Multiline为True的TextBox控件赋值=""时的自动换行
- multiLine TextBox 多行文本框的换行内容 在Label上换行显示
- 关于Textbox控件TextMode的属性变成MultiLine后,其MaxLength不可用的解决方案
- textbox的textmode取为multiline多行时,其maxlength不起作用
- Get your Crystal report working on your customers server (Cannot find KeycodeV2.dll, or invalid keycode)
- java文件操作大全
- 云开“出山”!
- 跑题
- [商业]博客中国的新广告方式
- textBox multiline
- Forms authentication without a (visible) form
- Start - blog第一贴
- 设计模式之State——交通篇(原创)
- 编程经验点滴(一)——《C 语言中定义字符串的问题》
- 今天被一个小问题搞死...
- VPC 的一些tips
- Exporting from Crystal Reports to PDF, Word, Excel and HTML
- STL实践指南