Auto Scrolling Windows Form for Dynamic Content
<p>I'm working on C# .NET 3.5 desktop application. In the software I have a <code>Form</code>, which contains a <code>TableLayoutPanel</code> <code>tp1</code>. The 2nd row of the <code>tp1</code> contains a <code>GroupBox</code>. The <code>GroupBox</code> contains another <code>TableLayoutPanel</code> <code>tp2</code>. <code>tp2</code> will grow dynamically during runtime.</p>

<pre><code>Form
-----------------------------
|  TableLayoutPanel tp1      |
|____________________________|
|    GroupBox                |
|    ________________________|
|   |                        |
|   |  TableLayoutPanel tp2  |
|   |  ______________________|
|   | |                      |
|   | |   Dynamic content    |
|   | |        here          |
|   | |                      |
|   | |______________________|
|   |________________________|
|                            |
|____________________________|
-----------------------------
</code></pre>

<p>The AutoScroll of the <code>Form</code> is true.</p>

<p>The SizeType of Row 2 of <code>tp1</code> is AutoSize.</p>

<p>The AutoSize of the <code>GroupBox</code> is true.</p>

<p>The AutoSize of <code>tp2</code> is true. <code>tp2</code> is dynamically updated by the following code:</p>

<pre><code>tp2.RowCount = tp2.RowCount + 1;
tp2.RowStyles.Add(new RowStyle(SizeType.AutoSize));

GroupBox gb = new GroupBox();
gb.BackColor = Color.Red;
tp2.Controls.Add(gb, 0, tp2.RowCount - 1);
</code></pre>

<p>I want a scrollbars to appear in the <code>Form</code> when <code>tp1</code> is larger than the window size. But no scrollbar is appearing.</p>

<p>I can activate scrollbars in the same way if I set AutoScroll to true for <code>tp1</code>. But I want the scrollbars on the <code>Form</code>, not <code>tp1</code>.</p>

<p>How can I achieve that?</p>