TextBox 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 TextBox 类的新实例。
public:
TextBox();
public TextBox ();
Public Sub New ()
示例
下面的代码示例创建 控件的新实例, TextBox 并将字符串分配给控件的 Text 属性。
public:
void CreateMyTextBoxControl()
{
// Create a new TextBox control using this constructor.
TextBox^ textBox1 = gcnew TextBox;
// Assign a string of text to the new TextBox control.
textBox1->Text = "Hello World!";
// Code goes here to add the control to the form's control collection.
}
public void CreateMyTextBoxControl()
{
// Create a new TextBox control using this constructor.
TextBox textBox1 = new TextBox();
// Assign a string of text to the new TextBox control.
textBox1.Text = "Hello World!";
// Code goes here to add the control to the form's control collection.
}
Public Sub CreateMyTextBoxControl()
' Create a new TextBox control using this constructor.
Dim textBox1 As New TextBox()
' Assign a string of text to the new TextBox control.
textBox1.Text = "Hello World!"
' Code goes here to add the control to the form's control collection.
End Sub
注解
父容器控件定义 的颜色 TextBox和字体设置。