Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Manning - Windows Forms Programming With CSharp.pdf
Скачиваний:
72
Добавлен:
24.05.2014
Размер:
14.98 Mб
Скачать

When this property is set to true on a top-level menu within an MDI application, the list of child forms is automatically added to the menu. Figure 16.10 shows an example of this behavior for the Window menu in our ParentForm class. The list of forms appears below any existing menu items, with a separator added just before the list.

Up to nine forms are displayed, with a “More Windows…” menu added if more than nine child forms exist. This additional menu is added by the .NET Framework, and will display a dialog showing the list of all child forms. An example of this “More Windows…” dialog is shown in figure 16.11. Note that even our PixelDlg form appears in this window.

Figure 16.11

The Select Window dialog displays all active windows in the application.

We can add this feature to our application simply by setting the MdiList property for the Window menu.

ENABLE A LIST OF CHILD WINDOWS TO APPEAR

 

Action

Result

 

 

 

1

In the ParentForm.cs [Design]

The MDI child windows will be automatically inserted

 

window, set the MdiList

when the contents of this menu are displayed.

 

property of the Window menu

 

 

to true.

 

 

 

 

That’s all it takes. Compile, run, and see it in action.

The related property MdiListItem exists in the Menu class, and can be used to identify the MenuItem instance that displays the list of child forms within a MainMenu instance. We have not used this property in our application.

Before we leave the topic of child form layout, it is also worth mentioning that child forms can be positioned manually using the standard members of the Control class such as the Top, Width, Size, and Location properties.

This completes our MDI application for the moment. As is our custom, a short recap of our accomplishments here will round out the chapter.

562

CHAPTER 16 MULTIPLE DOCUMENT INTERFACES