using System.Runtime.InteropServices;
namespace System.Windows.Forms {
-#if NET_2_0
[ComVisible (true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
-#endif
[DesignTimeVisible(false)]
[ToolboxItem(false)]
public sealed class MdiClient : Control {
#endregion // Local Variables
#region Public Classes
-#if NET_2_0
[ComVisible (false)]
-#endif
public new class ControlCollection : Control.ControlCollection {
private MdiClient owner;
SizeScrollBars ();
ArrangeWindows ();
}
-#if NET_2_0
+
protected override void ScaleControl (SizeF factor, BoundsSpecified specified)
{
// Never change the MdiClient's location
}
[System.ComponentModel.EditorBrowsable (EditorBrowsableState.Never)]
-#endif
protected override void ScaleCore (float dx, float dy)
{
base.ScaleCore (dx, dy);
}
}
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Never)]
[Browsable (false)]
public override ImageLayout BackgroundImageLayout {
base.BackgroundImageLayout = value;
}
}
-#endif
public Form [] MdiChildren {
get {
XplatUI.RequestNCRecalc (Parent.Handle);
ParentForm.PerformLayout ();
-#if NET_2_0
// If we closed the last child, unmerge the menus.
// If it's not the last child, the menu will be unmerged
// when another child takes focus.
if (parent_menu != null)
if (parent_menu.IsCurrentlyMerged)
ToolStripManager.RevertMerge (parent_menu);
-#endif
}
SizeScrollBars ();
SetParentText (false);
+ form.Dispose();
}
internal void ActivateNextChild ()
setting_windowstates = false;
-#if NET_2_0
if (form.MdiParent.MainMenuStrip != null)
form.MdiParent.MainMenuStrip.RefreshMdiItems ();
if (parent_menu.IsCurrentlyMerged)
ToolStripManager.RevertMerge (parent_menu);
- MenuStrip child_menu = null;
-
- foreach (Control c in form.Controls)
- if (c is MenuStrip)
- child_menu = (MenuStrip)c;
+ MenuStrip child_menu = LookForChildMenu (form);
if (form.WindowState != FormWindowState.Maximized)
RemoveControlMenuItems (wm);
if (child_menu != null)
ToolStripManager.Merge (child_menu, parent_menu);
}
-#endif
return maximize_this;
}
-#if NET_2_0
+ private MenuStrip LookForChildMenu (Control parent)
+ {
+ foreach (Control c in parent.Controls) {
+ if (c is MenuStrip)
+ return (MenuStrip)c;
+
+ if (c is ToolStripContainer || c is ToolStripPanel) {
+ MenuStrip ms = LookForChildMenu (c);
+
+ if (ms != null)
+ return ms;
+ }
+ }
+
+ return null;
+ }
+
internal void RemoveControlMenuItems (MdiWindowManager wm)
{
Form form = wm.form;
parent_menu.ResumeLayout ();
}
}
-#endif
internal void SetWindowState (Form form, FormWindowState old_window_state, FormWindowState new_window_state, bool is_activating_child)
{
internal Form ActiveMdiChild {
get {
-#if NET_2_0
if (ParentForm != null && !ParentForm.Visible)
return null;
-#endif
+
if (Controls.Count < 1)
return null;