抱歉,问题标题不是很清楚,但也许图片有助于描述我的问题:
图片 http://my.jetscreenshot.com/2951/20100604-ioyo-164kb.jpg
我希望父面板中的小子面板可以自动调整大小。这是我的标记和代码隐藏:
protected void Page_Load(object sender, EventArgs e)
{
var bkg = new[] { "background-color: wheat;", "background-color: gray;", "background-color: #AAAAAA;" };
var random = new Random();
for (var i = 0; i < 285; i++)
{
var panel = new Panel
{
Header = false,
Width = 60,
Height = 30,
BodyStyle = bkg[random.Next(0, 3)],
Frame = false,
StyleSpec = "padding-top: 1px; padding-left: 1px;",
ID = "panel_" + i,
Html = string.Format("<span class='x-unselectable'>{0}</span>", i)
};
var cell = new Cell();
cell.Items.Add(panel);
TableLayout1.Cells.Add(cell);
}
}
<ext:Panel ID="pnlWorkArea" runat="server" Title="Test">
<Body>
<ext:TableLayout ID="TableLayout1" runat="server" Columns="15">
</ext:TableLayout>
</Body>
</ext:Panel>