+2007-03-12 Jonathan Pobst <monkey@jpobst.com>
+
+ * Control.cs: Another place we don't call SizeFromClientSize.
+ * Form.cs: Another place we don't call SizeFromClientSize.
+ [Fixes bug #81125]
+
2007-03-12 Jackson Harper <jackson@ximian.com>
* TreeView.cs: Basically emulating some strangness here with
}
// Sometimes we need to do this calculation without it being virtual (constructor)
- private Size InternalSizeFromClientSize (Size clientSize)
+ internal Size InternalSizeFromClientSize (Size clientSize)
{
Rectangle ClientRect;
Rectangle WindowRect;
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void SetClientSizeCore(int x, int y) {
- Size NewSize = SizeFromClientSize (new Size (x, y));
+ Size NewSize = InternalSizeFromClientSize (new Size (x, y));
if (NewSize != Size.Empty)
SetBounds (bounds.X, bounds.Y, NewSize.Width, NewSize.Height, BoundsSpecified.Size);
}
#if NET_2_0
- [Test] // bug #80621
- public void DontCallSizeFromClientSizeInConstructor ()
+ [Test] // bug #80621, #81125
+ public void DontCallSizeFromClientSize ()
{
SizeControl sc = new SizeControl ();
Assert.AreEqual (0, sc.size_from_client_size_count, "A1");
+
+ sc.ClientSize = new Size (300, 300);
+ Assert.AreEqual (0, sc.size_from_client_size_count, "A2");
+
+ SizeForm sf = new SizeForm ();
+ sf.ShowInTaskbar = false;
+ sf.Show ();
+
+ Assert.AreEqual (0, sc.size_from_client_size_count, "A3");
+
+ sc.ClientSize = new Size (300, 300);
+ Assert.AreEqual (0, sc.size_from_client_size_count, "A4");
+
+ sf.Dispose ();
}
private class SizeControl : Control
return base.SizeFromClientSize (clientSize);
}
}
+
+ private class SizeForm : Form
+ {
+ public int size_from_client_size_count = 0;
+
+ protected override Size SizeFromClientSize (Size clientSize)
+ {
+ size_from_client_size_count++;
+ return base.SizeFromClientSize (clientSize);
+ }
+ }
#endif
public class MockControl : Control