通过


Control 构造函数

定义

初始化 Control 类的新实例。

重载

名称 说明
Control()

使用默认设置初始化类的新实例 Control

Control(String)

使用特定文本初始化类的新实例 Control

Control(Control, String)

使用特定文本初始化类的新实例 Control 作为子控件。

Control(String, Int32, Int32, Int32, Int32)

使用特定文本、大小和位置初始化类的新实例 Control

Control(Control, String, Int32, Int32, Int32, Int32)

将类的新实例初始化为具有特定文本、大小和位置的 Control 子控件。

Control()

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

使用默认设置初始化类的新实例 Control

public:
 Control();
public Control();
Public Sub New ()

注解

Control 类是 Windows 窗体应用程序中使用的所有控件的基类。 由于此类通常用于创建类的实例,因此此构造函数通常不直接调用,而是由派生类调用。

适用于

Control(String)

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

使用特定文本初始化类的新实例 Control

public:
 Control(System::String ^ text);
public Control(string text);
public Control(string? text);
new System.Windows.Forms.Control : string -> System.Windows.Forms.Control
Public Sub New (text As String)

参数

text
String

控件显示的文本。

注解

Control 类是 Windows 窗体应用程序中使用的所有控件的基类。 由于此类通常用于创建类的实例,因此此构造函数通常不直接调用,而是由派生类调用。

此版本的 Control 构造函数将初始 Text 属性值设置为 text 参数值。

适用于

Control(Control, String)

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

使用特定文本初始化类的新实例 Control 作为子控件。

public:
 Control(System::Windows::Forms::Control ^ parent, System::String ^ text);
public Control(System.Windows.Forms.Control parent, string text);
public Control(System.Windows.Forms.Control? parent, string? text);
new System.Windows.Forms.Control : System.Windows.Forms.Control * string -> System.Windows.Forms.Control
Public Sub New (parent As Control, text As String)

参数

parent
Control

Control 成为控件的父级。

text
String

控件显示的文本。

注解

Control 类是 Windows 窗体应用程序中使用的所有控件的基类。 由于此类通常用于创建类的实例,因此此构造函数通常不直接调用,而是由派生类调用。

此版本的 Control 构造函数将初始 Text 属性值设置为 text 参数值。 构造函数还会将控件添加到父控件的 Control.ControlCollection控件。

适用于

Control(String, Int32, Int32, Int32, Int32)

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

使用特定文本、大小和位置初始化类的新实例 Control

public:
 Control(System::String ^ text, int left, int top, int width, int height);
public Control(string text, int left, int top, int width, int height);
public Control(string? text, int left, int top, int width, int height);
new System.Windows.Forms.Control : string * int * int * int * int -> System.Windows.Forms.Control
Public Sub New (text As String, left As Integer, top As Integer, width As Integer, height As Integer)

参数

text
String

控件显示的文本。

left
Int32

控件 X 的位置(以像素为单位),位于控件容器的左边缘。 该值分配给 Left 属性。

top
Int32

控件 Y 的位置(以像素为单位),位于控件容器的上边缘。 该值分配给 Top 属性。

width
Int32

控件的宽度(以像素为单位)。 该值分配给 Width 属性。

height
Int32

控件的高度(以像素为单位)。 该值分配给 Height 属性。

注解

Control 类是 Windows 窗体应用程序中使用的所有控件的基类。 由于此类通常用于创建类的实例,因此此构造函数通常不直接调用,而是由派生类调用。

此版本的 Control 构造函数将初始 Text 属性值设置为 text 参数值。 控件的初始Size值和Location控件由left参数topwidth值和height参数值确定。

注释

若要保持更好的性能,请不要在其构造函数中设置控件的大小。 首选方法是重写 DefaultSize 属性。

适用于

Control(Control, String, Int32, Int32, Int32, Int32)

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

将类的新实例初始化为具有特定文本、大小和位置的 Control 子控件。

public:
 Control(System::Windows::Forms::Control ^ parent, System::String ^ text, int left, int top, int width, int height);
public Control(System.Windows.Forms.Control parent, string text, int left, int top, int width, int height);
public Control(System.Windows.Forms.Control? parent, string? text, int left, int top, int width, int height);
new System.Windows.Forms.Control : System.Windows.Forms.Control * string * int * int * int * int -> System.Windows.Forms.Control
Public Sub New (parent As Control, text As String, left As Integer, top As Integer, width As Integer, height As Integer)

参数

parent
Control

Control 成为控件的父级。

text
String

控件显示的文本。

left
Int32

控件 X 的位置(以像素为单位),位于控件容器的左边缘。 该值分配给 Left 属性。

top
Int32

控件 Y 的位置(以像素为单位),位于控件容器的上边缘。 该值分配给 Top 属性。

width
Int32

控件的宽度(以像素为单位)。 该值分配给 Width 属性。

height
Int32

控件的高度(以像素为单位)。 该值分配给 Height 属性。

注解

Control 类是 Windows 窗体应用程序中使用的所有控件的基类。 由于此类通常用于创建类的实例,因此此构造函数通常不直接调用,而是由派生类调用。

此版本的 Control 构造函数将初始 Text 属性值设置为 text 参数值。 构造函数还会将控件添加到父控件的 Control.ControlCollection控件。 控件的初始Size值和Location控件由left参数topwidth值和height参数值确定。

注释

若要保持更好的性能,请不要在其构造函数中设置控件的大小。 首选方法是重写 DefaultSize 属性。

适用于