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屬性是falseCreateControl 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.

適用於

另請參閱