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.