Control.InitLayout 方法

定义

在将控件添加到另一个容器之后调用。Called after the control has been added to another container.

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

注解

向容器添加控件后会立即调用 InitLayout 方法。The InitLayout method is called immediately after adding a control to a container. InitLayout 方法使控件可以根据其容器初始化其布局状态。The InitLayout method enables a control to initialize its layout state based on its container. 例如,通常会在 InitLayout 方法中对控件应用定位和停靠。For example, you would typically apply anchoring and docking to the control in the InitLayout method.

继承者说明

当在派生类中重写 InitLayout() 时,请确保调用基类的 InitLayout() 方法,以便正确显示控件。When overriding InitLayout() in a derived class, be sure to call the base class's InitLayout() method so that the control is displayed correctly.

适用于

另请参阅