Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just to better understand the owner-owned relationship:</p> <blockquote> <p>.NET allows a form to “own” other forms. Owned forms are useful for floating toolbox and command windows. One example of an owned form is the Find and Replace window in Microsoft Word. When an owner window is minimized, the owned forms are also minimized automatically. When an owned form overlaps its owner, it is always displayed on top.</p> </blockquote> <p>(c) "Pro .NET 2.0 Windows Forms and Custom Controls" by Matthew MacDonald.</p> <hr> <blockquote> <p>As <strong>ShowDialog</strong> shows the new form, an <strong>implicit relationship is established</strong> between the currently active form, known as the owner form, and the new form, known as the owned form. This relationship ensures that the owned form is the active form and is always shown on top of the owner form. </p> <p>One feature of this relationship is that the owned form affects the behavior of its owner form (when using <strong>ShowDialog</strong>):</p> <ul> <li>The owner form cannot be minimized, maximized, or even moved.</li> <li>The owned form blocks mouse and keyboard input to the owner form.</li> <li>The owner form is minimized when the owned form is.</li> <li>Only the owned form can be closed.</li> <li>If both owner and owned forms are minimized and if the user presses Alt+Tab to switch to the owned form, the owned form is activated. </li> </ul> <p>Unlike the ShowDialog method, however, a call to the <strong>Show</strong> method <strong>does not establish an implicit owner-owned relationship</strong>. This means that either form can be the currently active form.</p> <p>Without an implicit owner-owned relationship, owner and owned forms alike can be minimized, maximized, or moved. If the user closes any form other than the main form, the most recently active form is reactivated.</p> <p>Although <strong>ShowDialog establishes an implicit owner-owned relationship</strong>, there is no built-in way for the owned form to call back to or query the form that opened it. In the modeless case, you can set the new form's Owner property to establish the owner-owned relationship. As a shortcut, you could pass the owner form as an argument to an overload of the Show method, which also takes an IWin32Window parameter (IWin32Window is implemented by Windows Forms UI objects that expose a Win32 HWND property via the IWin32Window.Handle property).</p> <p>The behavior of forms in an explicit modal owner-owned form relationship is the same as its implicit modal counterpart, but the modeless owner-owned relationship provides additional behavior in the non-owner-owned modeless case. First, the modeless owned form always appears on top of the owner form, even though either can be active. This is useful when you need to keep a form, such as a floating tool window, on top of other forms within an application. Second, if the user presses Alt+Tab to switch from the owner, the owned forms follow suit. To ensure that the user knows which form is the main form, minimizing the owner hides the task bar buttons for all owned forms, leaving only the owner's task bar button visible.</p> </blockquote> <p>(c) "Windows Forms 2.0 Programming" by Chris Sells, Michael Weinhardt.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload