Label
动态还是静态的?
动态的可以这样
public void InitNodes(string path,Table t)
{
int count =100;
int row=10;int col;
if(count%row==0)
{
col=count/row; }
else
{
col=count/row+1; }
for(int j=0;j<col;j++)
{
TableRow tr=new TableRow();
t.Rows.Add(tr);
for(int i=0;i<row;i++)
{
if(i*col+j<count)
{
TableCell tc=new TableCell();
tr.Cells.Add(tc);
Label lb2=new Label();
lb2.Text="jjj";
tc.Controls.Add(lb2);
}
}
}
}
动态还是静态的?
动态的可以这样
public void InitNodes(string path,Table t)
{
int count =100;
int row=10;int col;
if(count%row==0)
{
col=count/row; }
else
{
col=count/row+1; }
for(int j=0;j<col;j++)
{
TableRow tr=new TableRow();
t.Rows.Add(tr);
for(int i=0;i<row;i++)
{
if(i*col+j<count)
{
TableCell tc=new TableCell();
tr.Cells.Add(tc);
Label lb2=new Label();
lb2.Text="jjj";
tc.Controls.Add(lb2);
}
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货