关于如何把我这个随机数生成的图片,并把图片指定的显示在 aspx页中某个位置的问题?
下面的这段代码就是能把生成的随机数变成图片显示出来,不过我现在不知道怎么能让这个图片在一个固定位置上显示出来,比如在一个 表格里<td></td>
public void Page_Load(object sender,EventArgs e)
{
string s=DateTime.Now.Second.ToString();
string filename=s;
string front_filename;
Random rrr=new Random();
front_filename=filename+rrr.Next(1000);
string strNum=front_filename;
string strFontName;
int iFontSize;
int iWidth;
int iHeight;
strFontName="宋体";
iFontSize=12;
iWidth=10*strNum.Length;
iHeight=25;
Color bgColor=Color.Yellow;
Color foreColor=Color.Red;
Font foreFont=new Font(strFontName,iFontSize,FontStyle.Bold);
Bitmap Pic=new Bitmap(iWidth,iHeight,PixelFormat.Format32bppArgb);
Graphics g=Graphics.FromImage(Pic);
Rectangle r=new Rectangle(0,0,iWidth,iHeight);
g.FillRectangle(new SolidBrush(bgColor),r);
g.DrawString(strNum,foreFont,new SolidBrush(foreColor),2,2);
MemoryStream mStream=new MemoryStream();
Pic.Save(mStream,ImageFormat.Gif);
g.Dispose();
Pic.Dispose();
Response.ClearContent();
Response.ContentType="image/GIF";
Response.BinaryWrite(mStream.ToArray());
Response.End();
}