Author: jpobst
Date: 2007-06-12 18:11:27 -0400 (Tue, 12 Jun 2007)
New Revision: 79347
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
Log:
2007-06-12 Jonathan Pobst <[EMAIL PROTECTED]>
* TableLayout.cs: When we come across a Dock=Fill control, use the
ExplicitSize to calculate an AutoSize row/column from.
[Fixes bug #81843]
2007-06-12 Jonathan Pobst <[EMAIL PROTECTED]>
* TableLayoutTest.cs: Add test for bug #81843.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
2007-06-12 21:30:36 UTC (rev 79346)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
2007-06-12 22:11:27 UTC (rev 79347)
@@ -1,3 +1,9 @@
+2007-06-12 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * TableLayout.cs: When we come across a Dock=Fill control, use the
+ ExplicitSize to calculate an AutoSize row/column from.
+ [Fixes bug #81843]
+
2007-06-07 Jonathan Pobst <[EMAIL PROTECTED]>
* DefaultLayout.cs: When calculating autosize children, default to
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
2007-06-12 21:30:36 UTC (rev 79346)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
2007-06-12 22:11:27 UTC (rev 79347)
@@ -261,9 +261,13 @@
if (c != null && c !=
dummy_control)
{
- if (c.Dock ==
DockStyle.Fill || ((c.Anchor & AnchorStyles.Left) == AnchorStyles.Left &&
(c.Anchor & AnchorStyles.Right) == AnchorStyles.Right))
+ if (c.Dock ==
DockStyle.Fill || ((c.Anchor & AnchorStyles.Left) == AnchorStyles.Left &&
(c.Anchor & AnchorStyles.Right) == AnchorStyles.Right)) {
+ if
(c.ExplicitBounds.Width + c.Margin.Left + c.Margin.Right > max_width)
+
max_width = c.ExplicitBounds.Width + c.Margin.Left + c.Margin.Right;
+
continue;
- else if
(settings.GetColumnSpan(c) > 1)
+ }
+ else if
(settings.GetColumnSpan (c) > 1)
continue;
if (c.Width +
c.Margin.Left + c.Margin.Right > max_width)
@@ -335,8 +339,12 @@
Control c =
panel.actual_positions[i, index];
if (c != null && c !=
dummy_control) {
- if (c.Dock ==
DockStyle.Fill || ((c.Anchor & AnchorStyles.Top) == AnchorStyles.Top &&
(c.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom))
+ if (c.Dock ==
DockStyle.Fill || ((c.Anchor & AnchorStyles.Top) == AnchorStyles.Top &&
(c.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom)) {
+ if
(c.ExplicitBounds.Height + c.Margin.Top + c.Margin.Bottom > max_height)
+
max_height = c.ExplicitBounds.Height + c.Margin.Top + c.Margin.Bottom;
+
continue;
+ }
else if
(settings.GetRowSpan (c) > 1)
continue;
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-06-12 21:30:36 UTC (rev 79346)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-06-12 22:11:27 UTC (rev 79347)
@@ -1,5 +1,9 @@
2007-06-12 Jonathan Pobst <[EMAIL PROTECTED]>
+ * TableLayoutTest.cs: Add test for bug #81843.
+
+2007-06-12 Jonathan Pobst <[EMAIL PROTECTED]>
+
* UpDownBaseTest.cs: Test for Min/Max size.
2007-06-12 Jonathan Pobst <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
2007-06-12 21:30:36 UTC (rev 79346)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
2007-06-12 22:11:27 UTC (rev 79347)
@@ -859,6 +859,65 @@
Assert.AreEqual (81, p.GetColumnWidths ()[0], "D3");
Assert.AreEqual (119, p.GetColumnWidths ()[1], "D4");
}
+
+ [Test]
+ public void Bug81843 ()
+ {
+ Form f = new Form ();
+ f.ShowInTaskbar = false;
+
+ TableLayoutPanel tableLayoutPanel1;
+ Button button2;
+ TextBox textBox1;
+ Button button4;
+
+ tableLayoutPanel1 = new TableLayoutPanel ();
+ button2 = new Button ();
+ button4 = new Button ();
+ textBox1 = new TextBox ();
+ tableLayoutPanel1.SuspendLayout ();
+ f.SuspendLayout ();
+
+ tableLayoutPanel1.AutoSize = true;
+ tableLayoutPanel1.ColumnCount = 3;
+ tableLayoutPanel1.ColumnStyles.Add (new ColumnStyle ());
+ tableLayoutPanel1.ColumnStyles.Add (new ColumnStyle ());
+ tableLayoutPanel1.ColumnStyles.Add (new ColumnStyle ());
+ tableLayoutPanel1.Controls.Add (button2, 0, 1);
+ tableLayoutPanel1.Controls.Add (button4, 2, 1);
+ tableLayoutPanel1.Controls.Add (textBox1, 1, 0);
+ tableLayoutPanel1.Location = new Point (0, 0);
+ tableLayoutPanel1.RowCount = 2;
+ tableLayoutPanel1.RowStyles.Add (new RowStyle
(SizeType.Percent, 50F));
+ tableLayoutPanel1.RowStyles.Add (new RowStyle
(SizeType.Percent, 50F));
+ tableLayoutPanel1.Size = new Size (292, 287);
+
+ button2.Size = new Size (75, 23);
+
+ button4.Size = new Size (75, 23);
+
+ textBox1.Dock = DockStyle.Fill;
+ textBox1.Location = new Point (84, 3);
+ textBox1.Multiline = true;
+ textBox1.Size = new Size (94, 137);
+
+ f.ClientSize = new Size (292, 312);
+ f.Controls.Add (tableLayoutPanel1);
+ f.Name = "Form1";
+ f.Text = "Form1";
+ tableLayoutPanel1.ResumeLayout (false);
+ tableLayoutPanel1.PerformLayout ();
+ f.ResumeLayout (false);
+ f.PerformLayout ();
+
+ f.Show ();
+
+ Assert.AreEqual (new Rectangle (3, 146, 75, 23),
button2.Bounds, "A1");
+ Assert.AreEqual (new Rectangle (184, 146, 75, 23),
button4.Bounds, "A2");
+ Assert.AreEqual (new Rectangle (84, 3, 94, 137),
textBox1.Bounds, "A3");
+
+ f.Dispose ();
+ }
}
}
#endif
\ No newline at end of file
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches