Form.ResizeBegin Form.ResizeBegin Form.ResizeBegin Form.ResizeBegin Event

定义

窗体进入大小调整模式时发生。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 code 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.ShowConsole.WriteLine或将消息附加到多行TextBoxTo 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.

若要运行此代码示例,请将其粘贴到包含类型的实例的项目Form名为Form1To 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. 零个或多个对ResizeSizeChanged作为窗体的事件发生Size被修改。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.

适用于

另请参阅