Procházet zdrojové kódy

2006-11-04 Chris Toshok <[email protected]>

	* Form.cs: if the form isn't visible, Close() does nothing.


svn path=/trunk/mcs/; revision=67362
Chris Toshok před 19 roky
rodič
revize
646be91170

+ 4 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,7 @@
+2006-11-04  Chris Toshok  <[email protected]>
+
+	* Form.cs: if the form isn't visible, Close() does nothing.
+
 2006-11-03  Chris Toshok  <[email protected]>
 
 	* Form.cs (Close): if the form is modal, don't Dispose of it, only

+ 11 - 7
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs

@@ -1167,13 +1167,17 @@ namespace System.Windows.Forms {
 		}
 
 		public void Close () {
-			if (!IsDisposed) {
-				XplatUI.SendMessage(this.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
-				if (is_modal)
-					Hide ();
-				else
-					Dispose ();
-			}
+			if (IsDisposed)
+				return;
+
+			if (!is_visible)
+				return;
+
+			XplatUI.SendMessage(this.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
+			if (is_modal)
+				Hide ();
+			else
+				Dispose ();
 		}
 
 		public void LayoutMdi(MdiLayout value) {