Control.CreateControl Control.CreateControl Control.CreateControl Control.CreateControl Method

定义

强制创建可见控件,包括创建句柄和任何可见子控件。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.

CreateControl如果控件的Visible属性为false,则不创建控件句柄。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.

适用于

另请参阅