Author: jpobst
Date: 2007-06-01 18:14:09 -0400 (Fri, 01 Jun 2007)
New Revision: 78463
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
Log:
2007-06-01 Jonathan Pobst <[EMAIL PROTECTED]>
* Control.cs: Don't perform layout when AutoSize changes.
* Form.cs: Perform layout in AutoSize override. Don't set ClientSize
directly when autosizing, use SetBounds with BoundsSpecified.None.
Fixes unit tests my last commit broke.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-06-01 21:27:47 UTC (rev 78462)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-06-01 22:14:09 UTC (rev 78463)
@@ -1,5 +1,12 @@
2007-06-01 Jonathan Pobst <[EMAIL PROTECTED]>
+ * Control.cs: Don't perform layout when AutoSize changes.
+ * Form.cs: Perform layout in AutoSize override. Don't set ClientSize
+ directly when autosizing, use SetBounds with BoundsSpecified.None.
+ Fixes unit tests my last commit broke.
+
+2007-06-01 Jonathan Pobst <[EMAIL PROTECTED]>
+
* Control.cs: Perform layout when AutoSize changes.
* Form.cs: Implement AutoSizing.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2007-06-01 21:27:47 UTC (rev 78462)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2007-06-01 22:14:09 UTC (rev 78463)
@@ -2107,7 +2107,6 @@
if (!value)
Size = explicit_bounds.Size;
- PerformLayout (this, "AutoSize");
OnAutoSizeChanged (EventArgs.Empty);
}
}
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-06-01 21:27:47 UTC (rev 78462)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-06-01 22:14:09 UTC (rev 78463)
@@ -474,7 +474,12 @@
#if NET_2_0
public override bool AutoSize {
get { return base.AutoSize; }
- set { base.AutoSize = value; }
+ set {
+ if (base.AutoSize != value) {
+ base.AutoSize = value;
+ PerformLayout (this, "AutoSize");
+ }
+ }
}
[Localizable (true)]
@@ -3014,23 +3019,25 @@
base.OnLayout (levent);
if (this.AutoSize) {
+ Size new_size;
+
if (this.AutoSizeMode ==
AutoSizeMode.GrowAndShrink)
- this.ClientSize = GetPreferredSizeCore
(this.ClientSize);
+ new_size = GetPreferredSizeCore
(this.ClientSize);
else {
- Size s = GetPreferredSizeCore
(this.ClientSize);
-
- if (this.ClientSize.Height > s.Height)
- s.Height =
this.ClientSize.Height;
- if (this.ClientSize.Width > s.Width)
- s.Width = this.ClientSize.Width;
-
- if (!s.Equals (this.ClientSize)) {
- Size NewSize =
InternalSizeFromClientSize (s);
-
- if (NewSize != Size.Empty)
- SetBounds (bounds.X,
bounds.Y, NewSize.Width, NewSize.Height, BoundsSpecified.None);
- }
+ new_size = GetPreferredSizeCore
(this.ClientSize);
+
+ if (this.ClientSize.Height >
new_size.Height)
+ new_size.Height =
this.ClientSize.Height;
+ if (this.ClientSize.Width >
new_size.Width)
+ new_size.Width =
this.ClientSize.Width;
}
+
+ if (!new_size.Equals (this.ClientSize)) {
+ Size NewSize =
InternalSizeFromClientSize (new_size);
+
+ if (NewSize != Size.Empty)
+ SetBounds (bounds.X, bounds.Y,
NewSize.Width, NewSize.Height, BoundsSpecified.None);
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches