Control.OnLayout(LayoutEventArgs) 方法

定义

引发 Layout 事件。

C#
protected virtual void OnLayout(System.Windows.Forms.LayoutEventArgs levent);

参数

levent
LayoutEventArgs

包含事件数据的 LayoutEventArgs

注解

引发事件时,将通过委托调用事件处理程序。 有关详细信息,请参阅 处理和引发事件

OnLayout 方法还允许派生类对事件进行处理而不必附加委托。 这是在派生类中处理事件的首选技术。

继承者说明

在派生类中重写 OnLayout(LayoutEventArgs) 时,请务必调用基类的 OnLayout(LayoutEventArgs) 方法,以便注册的委托接收事件,并使典型的停靠和定位函数正常工作。 派生类应重写此方法以执行任何自定义布局逻辑。

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另请参阅