将textBox控件放在Panel控件中,就可以定位了 this.panel1.Controls.Add(this.textBox1); this.textBox1.Loaction = new Point(x,y);
.动态添加表格行Function AddRow(ByVal i, ByVal tr1) Dim td1 As New TableCell() Dim td2 As New TableCell() Table2.CellPadding = 0 Table2.CellSpacing = 0 tr1.BackColor = Color.LightGray td1.HorizontalAlign = HorizontalAlign.Center td2.HorizontalAlign = HorizontalAlign.Center td1.VerticalAlign = VerticalAlign.Middle td1.BorderColor = Color.Black td2.BorderColor = Color.Black td1.BorderWidth = Unit.Pixel(1) td2.BorderWidth = Unit.Pixel(1) Dim txtXx As New TextBox() txtXx.Width = Unit.Pixel(50) txtXx.ID = "xx" + i.ToString() td1.Text = "option" + i.ToString() td2.Controls.Add(txtXx) tr1.Cells.Add(td1) tr1.Cells.Add(td2) Table2.Rows.Add(tr1) End Function Function addrow2(ByVal i) Dim txtXx As New TextBox() txtXx.Width = Unit.Pixel(10) txtXx.ID = "xx" + i.ToString() Page.Controls.Add(txtXx) End Function Function add3(ByVal tr As TableRow) Dim txtXx As New TextBox() txtXx.Width = Unit.Pixel(100) txtXx.ID = "xx" + i.ToString() txtXx.Text = "option" + i.ToString() Dim td As New TableCell() td.Controls.Add(txtXx) tr.Cells.Add(td) Table2.Rows.Add(tr) End FunctionTable tb=new Table(); try { tb.Attributes.Remove("style"); tb.Atrributes.Add("style","border-style:None;width:940px;word-break:break-all; word-wrap: break-word;"); } catch(Exception ex) { throw(ex); }
this.panel1.Controls.Add(this.textBox1);
this.textBox1.Loaction = new Point(x,y);
Dim td2 As New TableCell()
Table2.CellPadding = 0
Table2.CellSpacing = 0 tr1.BackColor = Color.LightGray td1.HorizontalAlign = HorizontalAlign.Center
td2.HorizontalAlign = HorizontalAlign.Center
td1.VerticalAlign = VerticalAlign.Middle
td1.BorderColor = Color.Black
td2.BorderColor = Color.Black td1.BorderWidth = Unit.Pixel(1)
td2.BorderWidth = Unit.Pixel(1) Dim txtXx As New TextBox()
txtXx.Width = Unit.Pixel(50)
txtXx.ID = "xx" + i.ToString()
td1.Text = "option" + i.ToString()
td2.Controls.Add(txtXx) tr1.Cells.Add(td1)
tr1.Cells.Add(td2) Table2.Rows.Add(tr1) End Function
Function addrow2(ByVal i)
Dim txtXx As New TextBox()
txtXx.Width = Unit.Pixel(10)
txtXx.ID = "xx" + i.ToString()
Page.Controls.Add(txtXx)
End Function
Function add3(ByVal tr As TableRow)
Dim txtXx As New TextBox()
txtXx.Width = Unit.Pixel(100)
txtXx.ID = "xx" + i.ToString()
txtXx.Text = "option" + i.ToString() Dim td As New TableCell()
td.Controls.Add(txtXx)
tr.Cells.Add(td)
Table2.Rows.Add(tr)
End FunctionTable tb=new Table();
try
{
tb.Attributes.Remove("style");
tb.Atrributes.Add("style","border-style:None;width:940px;word-break:break-all; word-wrap: break-word;");
}
catch(Exception ex)
{
throw(ex);
}