Event Sequence in Windows Forms

Source: Internet
Author: User

For developers who focus on processing events in the Windows Forms Application in order, the order of events is particularly important. When you need to handle events with caution in some cases (such as redrawing some parts of the form), you must know the exact sequence of events during running. This topic provides detailed information about the event sequence in several important phases of the application and control lifecycle. For more information about the sequence of mouse input events, see mouse events in Windows Forms. For an overview of events in Windows Forms, see event Overview (Windows Forms ). For more information about the composition of event handlers, see Event Handlers Overview (Windows Forms ).

Application startup and shutdown events

The Form and Control classes expose a group of events associated with application startup and shutdown. When a Windows form application is started, the startup events of the main form are triggered in the following order:

  • Control...:. HandleCreated

  • Control...:. BindingContextChanged

  • Form...:. Load

  • Control...:. VisibleChanged

  • Form...:. Activated

  • Form...:. Shown

When an application is closed, the closing event of the main form is triggered in the following order:

  • Form...:. Closing

  • Form...:. FormClosing

  • Form...:. Closed

  • Form...:. FormClosed

  • Form...:. Deactivate

The ApplicationExit event of the Application class is triggered after the closing event of the main form.

Note:

Visual Basic 2005 provides additional application events, such as WindowsFormsApplicationBase...:. Startup and WindowsFormsApplicationBase...:. Shutdown. For more information, see How to: Handle Application Events (Visual Basic ).

(From: http://msdn.microsoft.com/en-us/86faxx0d (zh-cn, VS.90). aspx)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.