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.

适用于

另请参阅