窗口激活和失活

To become the official active window, i.e. the window that is returned by the Application.ActiveWindow property, a window:
  • Must be a top-level window.

  • Or must implement the Form_Activate event handler if it is an embedded window.

When a control gets the focus, then its window becomes the active window, provided this window can become the current active window as explained above.

If its window cannot become the current active window, then the parent window of this window is tried, and so on, until a top-level window is reached.

Activating a window sends a Deactivate event to the old current active window, and an Activate event to the new one.

When the application is iconified, the current active window is deactivated. When the application is uniconified, then the current active window is reactivated again.