Form.ResizeBegin 事件

定义

窗体进入大小调整模式时发生。Occurs when a form enters resizing mode.

public:
 event EventHandler ^ ResizeBegin;
public event EventHandler ResizeBegin;
member this.ResizeBegin : EventHandler 
Public Custom Event ResizeBegin As EventHandler 

示例

下面的示例演示如何使用此成员。The following example demonstrates the use of this member. 在此示例中,事件处理程序报告 ResizeBegin 事件的发生。In the example, an event handler reports on the occurrence of the ResizeBegin event. 此报表可帮助你了解何时发生事件,并可帮助你进行调试。This report helps you to learn when the event occurs and can assist you in debugging. 若要报告多个事件或频繁发生的事件,请考虑将 MessageBox.Show 替换为 Console.WriteLine 或将消息附加到多行 TextBox中。To report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

若要运行示例代码,请将其粘贴到包含名为 Form1Form 类型实例的项目中。To run the example code, paste it into a project that contains an instance of type Form named Form1. 然后,确保事件处理程序与 ResizeBegin 事件关联。Then ensure that the event handler is associated with the ResizeBegin event.

private void Form1_ResizeBegin(Object sender, EventArgs e) {

   MessageBox.Show("You are in the Form.ResizeBegin event.");

}
Private Sub Form1_ResizeBegin(sender as Object, e as EventArgs) _ 
     Handles Form1.ResizeBegin

   MessageBox.Show("You are in the Form.ResizeBegin event.")

End Sub

注解

当用户开始调整窗体大小时,通常通过单击并拖动窗体右下角的一个边框或大小调整手柄来引发 ResizeBegin 事件。The ResizeBegin event is raised when the user begins to resize a form, typically by clicking and dragging one of the borders or the sizing grip located on the lower-right corner of the form. 此操作使窗体成为模式大小循环,直到调整大小操作完成。This action puts the form into a modal sizing loop until the resize operation is completed. 通常,在调整大小操作过程中将发生以下一组事件:Typically, the following set of events occurs during a resize operation:

  1. 当窗体进入大小调整模式时,将发生单个 ResizeBegin 事件。A single ResizeBegin event occurs as the form enters resizing mode.

  2. 当修改窗体的 Size 时,零个或多对 ResizeSizeChanged 事件发生。Zero or more pairs of Resize and SizeChanged events occur as the form's Size is modified.

  3. 当窗体退出大小调整模式时,将发生单个 ResizeEnd 事件。A single ResizeEnd event occurs as the form exits resizing mode.

备注

只需在边框上单击而不拖动,调整手柄就会生成 ResizeBeginResizeEnd 事件,无需任何中间 ResizeSizeChanged 事件对。Just clicking without dragging on a border or resizing grip will generate the ResizeBegin and ResizeEnd events without any intermediate Resize and SizeChanged event pairs.

当用户移动窗体时,通常通过在标题栏上单击和拖动来引发 ResizeBeginResizeEnd 对事件。The ResizeBegin and ResizeEnd pair of events is also raised when the user moves the form, typically by clicking and dragging on the caption bar. 此类事件不是通过编程方式操作(例如,通过更改 SizeLocation 属性)生成的。These events are not generated by programmatic manipulation of the form, for example by changing the Size or Location properties.

有关处理事件的详细信息,请参阅处理和引发事件For more information about handling events, see Handling and Raising Events.

适用于

另请参阅