Control.CreateHandle 方法

定义

为该控件创建句柄。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. 关联枚举: UIPermissionWindowAllWindows 值。Associated enumeration: AllWindows value of UIPermissionWindow.

适用于

另请参阅