+2008-06-02 Jonathan Pobst <monkey@jpobst.com>
+
+ * TableLayout.cs: Fix a c&p error so we correctly calculate row
+ border heights. [Fixes part of bug #396433]
+
2008-03-05 Jonathan Pobst <monkey@jpobst.com>
ArrangedElementCollection.cs: corcompare - fix parameter names.
panel.column_widths[col_styles.Count - 1] += total_width;
// Figure up all the row heights
- int total_height = parentDisplayRectangle.Height - (border_width * columns);
+ int total_height = parentDisplayRectangle.Height - (border_width * (rows + 1));
index = 0;
// First assign all the Absolute sized rows..
+2008-06-02 Jonathan Pobst <monkey@jpobst.com>
+
+ * TableLayoutPanel.cs: Use border sizes when calculating the
+ panel's preferred size. [Fixes part of bug #396433]
+
2008-06-02 Ivan N. Zlatev <contact@i-nz.net>
* SplitContainer.cs:
non_percent_total_height += row_heights[j];
}
- return new Size (non_percent_total_width + percent_total_width, non_percent_total_height + percent_total_height);
+ int border_width = GetCellBorderWidth (CellBorderStyle);
+ return new Size (non_percent_total_width + percent_total_width + (border_width * (actual_cols + 1)), non_percent_total_height + percent_total_height + (border_width * (actual_rows + 1)));
}
#endregion
\r
f.Dispose ();\r
}\r
+ \r
+ [Test]\r
+ public void Bug396433 ()\r
+ {\r
+ // We were not taking the CellBorderStyle into account when calculating\r
+ // the preferred size.\r
+\r
+ Form f = new Form ();\r
+ f.ClientSize = new Size (300, 300);\r
+ f.ShowInTaskbar = false;\r
+\r
+ TableLayoutPanel tlp = new TableLayoutPanel ();\r
+ tlp.AutoSize = true;\r
+ tlp.AutoSizeMode = AutoSizeMode.GrowAndShrink;\r
+ tlp.ColumnCount = 2;\r
+ tlp.RowCount = 1;\r
+\r
+ f.Controls.Add (tlp);\r
+\r
+ Button t1 = new Button ();\r
+ tlp.Controls.Add (t1);\r
+\r
+ Button t2 = new Button ();\r
+ tlp.Controls.Add (t2);\r
+\r
+ f.Show ();\r
+\r
+ Assert.AreEqual (new Size (162, 29), tlp.PreferredSize, "A1");\r
+ \r
+ tlp.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;\r
+\r
+ Assert.AreEqual (new Size (165, 31), tlp.PreferredSize, "A2");\r
+\r
+ f.Dispose ();\r
+ }\r
}\r
}\r
#endif\r