Author: jpobst
Date: 2008-02-08 10:30:44 -0500 (Fri, 08 Feb 2008)
New Revision: 95264
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
Log:
2008-02-08 Jonathan Pobst <[EMAIL PROTECTED]>
* MdiClient.cs: Make sure the requesting form actually owns the
control menu items before removing them. Also, use
Suspend/ResumeLayout when adding or removing items so we only
layout once.
[Fixes bug #359887]
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-08 15:15:19 UTC (rev 95263)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-08 15:30:44 UTC (rev 95264)
@@ -1,5 +1,13 @@
2008-02-08 Jonathan Pobst <[EMAIL PROTECTED]>
+ * MdiClient.cs: Make sure the requesting form actually owns the
+ control menu items before removing them. Also, use
+ Suspend/ResumeLayout when adding or removing items so we only
+ layout once.
+ [Fixes bug #359887]
+
+2008-02-08 Jonathan Pobst <[EMAIL PROTECTED]>
+
* Control.cs: Guard against an NRE in ShowFocusCues.
[Fixes bug #359830]
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
2008-02-08 15:15:19 UTC (rev 95263)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
2008-02-08 15:30:44 UTC (rev 95264)
@@ -860,10 +860,12 @@
}
if (!found) {
+ parent_menu.SuspendLayout ();
parent_menu.Items.Insert (0,
new MdiControlStrip.SystemMenuItem (form));
parent_menu.Items.Add (new
MdiControlStrip.ControlBoxMenuItem (form,
MdiControlStrip.ControlBoxType.Close));
parent_menu.Items.Add (new
MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Max));
parent_menu.Items.Add (new
MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Min));
+ parent_menu.ResumeLayout ();
}
}
@@ -880,11 +882,23 @@
{
Form form = wm.form;
MenuStrip parent_menu = form.MdiParent.MainMenuStrip;
-
- if (parent_menu != null)
- for (int i = parent_menu.Items.Count - 1; i >=
0; i--)
- if (parent_menu.Items[i] is
MdiControlStrip.SystemMenuItem || parent_menu.Items[i] is
MdiControlStrip.ControlBoxMenuItem)
- parent_menu.Items.RemoveAt (i);
+
+ // Only remove the items if the form requesting still
owns the menu items
+ if (parent_menu != null) {
+ parent_menu.SuspendLayout ();
+
+ for (int i = parent_menu.Items.Count - 1; i >=
0; i--) {
+ if (parent_menu.Items[i] is
MdiControlStrip.SystemMenuItem) {
+ if ((parent_menu.Items[i] as
MdiControlStrip.SystemMenuItem).MdiForm == form)
+
parent_menu.Items.RemoveAt (i);
+ } else if (parent_menu.Items[i] is
MdiControlStrip.ControlBoxMenuItem) {
+ if ((parent_menu.Items[i] as
MdiControlStrip.ControlBoxMenuItem).MdiForm == form)
+
parent_menu.Items.RemoveAt (i);
+ }
+ }
+
+ parent_menu.ResumeLayout ();
+ }
}
#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches