王朝网络
分享
 
 
 

textBox multiline

王朝other·作者佚名  2006-01-09
宽屏版  字体: |||超大  

[/url]

获取或设置一个值,该值指示在多行文本框控件中按 TAB 键时,是否在控件中键入一个 TAB 字符,而不是按选项卡的顺序将焦点移动到下一个控件。

[Visual Basic]

Public Property AcceptsTab As [url=ms-help://MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfsystembooleanclasstopic.htm]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、AcceptsReturnWordWrap 属性来使多行文本框控件可用于创建文本文档。

[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 | TextBoxBase 成员(Visual J# 语法) | C++ 托管扩展编程

发送有关此主题的意见

© 2001-2002 Microsoft Corporation。保留所有权利。

获取或设置一个值,该值指示在多行 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 命名空间 | TextBox 成员(Visual J# 语法) | C++ 托管扩展编程

发送有关此主题的意见

© 2001-2002 Microsoft Corporation。保留所有权利。

指示多行文本框控件在必要时是否自动换行到下一行的开始。

[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 控件。此示例还使用 AcceptsTabAcceptsReturn 和 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 命名空间 | TextBoxBase 成员(Visual J# 语法) | C++ 托管扩展编程

发送有关此主题的意见

© 2001-2002 Microsoft Corporation。保留所有权利。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有