动态生成图片。类似验证码
HtmlTable table_House = new HtmlTable();
if (feild!=null)
{
table_House.Style.Add("width", "100%");
table_House.Style.Add("cellpadding", "0px");
table_House.Style.Add("cellpadding", "0px");
for (int i = 0; i < Fieldhouse.Length; i++)
{
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tdName = new HtmlTableCell();
tdName.InnerText = Fieldhouse[i].fieldName;
tdName.Style.Add("text-align", "center");
tdName.Style.Add("width", "50%");
tdName.Style.Add("border-bottom", "solid 2px #E5E5E5");
tdName.Style.Add("border-right", "solid 2px #E5E5E5");
HtmlTableCell tdValue = new HtmlTableCell();
tdValue.InnerText = Fieldhouse[i].fieldValue;
tdValue.Style.Add("text-align", "center");
tdValue.Style.Add("width", "50%");
tdValue.Style.Add("border-bottom", "solid 2px #E5E5E5");
tr.Cells.Add(tdName);
tr.Cells.Add(tdValue);
table_House.Rows.Add(tr);
}
}
int heigth=feild.Length*20;
System.Drawing.Bitmap img = new System.Drawing.Bitmap(heigth, 790);
using (System.Drawing.Graphics g =System.Drawing.Graphics.FromImage(img))
{
g.Clear(System.Drawing.Color.White);
}
我动态生成了一个表格并且绑定了数据。也生成了一个图片。我想把这个表格写入到这个图片(img)中。并显示到页面上。哪位大哥能教教
if (feild!=null)
{
table_House.Style.Add("width", "100%");
table_House.Style.Add("cellpadding", "0px");
table_House.Style.Add("cellpadding", "0px");
for (int i = 0; i < Fieldhouse.Length; i++)
{
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tdName = new HtmlTableCell();
tdName.InnerText = Fieldhouse[i].fieldName;
tdName.Style.Add("text-align", "center");
tdName.Style.Add("width", "50%");
tdName.Style.Add("border-bottom", "solid 2px #E5E5E5");
tdName.Style.Add("border-right", "solid 2px #E5E5E5");
HtmlTableCell tdValue = new HtmlTableCell();
tdValue.InnerText = Fieldhouse[i].fieldValue;
tdValue.Style.Add("text-align", "center");
tdValue.Style.Add("width", "50%");
tdValue.Style.Add("border-bottom", "solid 2px #E5E5E5");
tr.Cells.Add(tdName);
tr.Cells.Add(tdValue);
table_House.Rows.Add(tr);
}
}
int heigth=feild.Length*20;
System.Drawing.Bitmap img = new System.Drawing.Bitmap(heigth, 790);
using (System.Drawing.Graphics g =System.Drawing.Graphics.FromImage(img))
{
g.Clear(System.Drawing.Color.White);
}
我动态生成了一个表格并且绑定了数据。也生成了一个图片。我想把这个表格写入到这个图片(img)中。并显示到页面上。哪位大哥能教教
...全文


