日期:2014-05-16  浏览次数:20361 次

如何根据坐标,动态生成文本框?
如何根据坐标,动态生成文本框?
从数据库中去的坐标后,根据取得的坐标集合,生成文本输入框,由几组坐标,就根据坐标生成相应的文本框控件。

请高手指教.
谢谢!

------解决方案--------------------
把文本框放在div中,div的位置设成绝对位置就可以了
------解决方案--------------------
以前用C#做过个类似的
先放个Panel id= "p "
然后
foreach(item i in 坐标集合)
{
Textbox txt = new Textbox();
txt.Style[ "LEFT "] = i(left).ToString()+ "px ";
txt.Style[ "TOP "] = i(top).ToString()+ "px ";
p.Controls.Add(txt);
}


原来写的代码
foreach(DataRow row in dt.Rows)
{
Label lbl = new Label();
lbl.ID = "lbl "+row[ "BP_ID "].ToString();
lbl.Text = row[ "Remark "].ToString();
lbl.Style[ "LEFT "] = row[ "BP_Left "].ToString()+ "px ";
lbl.Style[ "TOP "] = row[ "BP_Top "].ToString()+ "px ";
lbl.Style[ "width "]=row[ "BP_Width "].ToString()+ "px ";
lbl.Style[ "height "]=row[ "BP_Height "].ToString()+ "px ";
this.panel1.Controls.Add(lbl);
}

希望对你有帮助