which was named testmenuItem?

You are busy to create a MenuStrip control named testmenuStrip to a container form named testcontainerForm in a Microsoft Windows Forms application. The testcontainerForm contains tree child forms.
Which code segment should you use to create a windows list menu so that each name of each child window is displayed on a ToolStripMenuItem control which was named testmenuItem?

You are busy to create a MenuStrip control named testmenuStrip to a container form named testcontainerForm in a Microsoft Windows Forms application. The testcontainerForm contains tree child forms.
Which code segment should you use to create a windows list menu so that each name of each child window is displayed on a ToolStripMenuItem control which was named testmenuItem?

A.
testmenuStrip.MdiWindowListItem = menuItem;

B.
testcontainerFrom.IsMdiContainer = true;

C.
foreach [Control childForm in testcontainerForm.Controls] {
ToolStripMenuItem item = new ToolStripMenuItem[childForm.Text];
testmenuItem.DropDownItems.Add[item];
}

D.
foreach [Form childForm in Application.OpenForms]
{
ToolStripMenuItem item = new ToolStripMenuItem[childForm.Text];
testmenuItem.DropDownItems.Add[item];
}

Explanation:

You need to set the MdiWindowListItem property to the ToolStripMenuItem that has the window list items.

Incorrect Answers:
C, D: A ToolStripMenuItem should not be put in manually of each Form instance. This collection has all the open form, which has the container form. You also should not add the ToolStripMenuItem manually for each Control instance.



Leave a Reply 0

Your email address will not be published. Required fields are marked *