Control.CreateControl 方法

定义

强制创建可见控件,包括创建句柄和任何可见子控件。Forces the creation of the visible control, including the creation of the handle and any visible child controls.

public:
 void CreateControl();
public void CreateControl ();
member this.CreateControl : unit -> unit
Public Sub CreateControl ()

注解

CreateControl 方法强制为控件及其子控件创建句柄。The CreateControl method forces a handle to be created for the control and its child controls. 如果需要立即处理控件或其子级的句柄,则使用此方法;只调用控件的构造函数不会创建 HandleThis method is used when you need a handle immediately for manipulation of the control or its children; simply calling a control's constructor does not create the Handle.

如果控件的 Visible 属性 falseCreateControl 不会创建控制句柄。CreateControl does not create a control handle if the control's Visible property is false. 可以调用 CreateHandle 方法或访问 Handle 属性,以创建控件的句柄,而不考虑控件的可见性,但在这种情况下,不会为控件的子级创建窗口句柄。You can either call the CreateHandle method or access the Handle property to create the control's handle regardless of the control's visibility, but in this case, no window handles are created for the control's children.

适用于

另请参阅