Control.CreateHandle Control.CreateHandle Control.CreateHandle Control.CreateHandle Method

定義

建立控制項的控制代碼。Creates a handle for the control.

protected:
 virtual void CreateHandle();
protected virtual void CreateHandle ();
abstract member CreateHandle : unit -> unit
override this.CreateHandle : unit -> unit
Protected Overridable Sub CreateHandle ()

例外狀況

物件為已處置狀態。The object is in a disposed state.

備註

您通常不應該直接呼叫CreateHandle方法。You typically should not call the CreateHandle method directly. 慣用的方法是呼叫CreateControl方法,這會在建立控制項時,強制建立控制項及其子控制項的控制碼。The preferred method is to call the CreateControl method, which forces a handle to be created for the control and its child controls when the control is created.

給繼承者的注意事項

在衍生CreateHandle()類別中覆寫時,請務必呼叫基類的CreateHandle()方法,以確保會建立控制碼。When overriding CreateHandle() in a derived class, be sure to call the base class's CreateHandle() method to ensure that the handle is created.

安全性

UIPermission
適用于繼承類別以呼叫這個方法的所有視窗。for all windows for inheriting classes to call this method. 相關聯的AllWindows列舉: UIPermissionWindow的值。Associated enumeration: AllWindows value of UIPermissionWindow.

適用於

另請參閱