Weird Windows Form Events

Source: Internet
Author: User

I haven't been here for a long time because of my busy work.

In MS WebMatrix, a new event is added to Form: InitActivated. This code is detected, and it is only a special case of Form Activated events, this event is triggered when Activated is triggered for the first time. The Code is as follows:

If (! This. _ initActivatedRaised)
{
This. _ initActivatedRaised = true;
This. OnInitActivated (e );
}

This code is very practical and solves the problem that I used to wait for all the content of the form to be loaded and the processing code must be placed in OnLoad (it is inconvenient to put it in OnLoad, there are many unexpected problems, which are annoying ).

Recently, it was found that this desire was lost, that is, the InitActivated event was triggered before the Load event. He discussed with his colleagues that there was no problem.

I found a new weird problem later: I showed a Dialog in the InitActivated event and found that if the form is normal, the initialization content of the form has been loaded (as shown on the interface ), if the status is maximized, it is not.

Therefore, we track OnInitActivated and OnLoad and find that in normal state, OnLoad is executed first and then in maximized state.

Ms form policy !!!

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.