private void Button1_Click(object sender, System.EventArgs e)
{
// Create Bitmap and Graphics objects
Bitmap curBitmap = new Bitmap("d:\\ASP_Web\\123.jpg");
Graphics g = Graphics.FromImage(curBitmap);
// Create pen
Pen pen = new Pen(Color.Red, 3);
//Draw line on the graphics
g.DrawLine(pen,0,0,100,100);
curBitmap.Save(this.Response.OutputStream,ImageFormat.Jpeg)
//dispose the graphics
g.Dispose();
}
这是Button内触发的事件,即我希望点击button后在当前页面上显示一幅图片,该图片上有一条直线.但运行后点击button时,图片是在新的页面上显示的,我怀疑是否要将 curBitmap.Save(this.Response.OutputStream,ImageFormat.Jpeg)中的参数Response.OutputStream修改一下,该语句直接将图片输出到新的页面了,但我用Response.writer("字符串")时,是输出在当前页面.
肯请大侠帮忙!!!
不胜感激!!! 另外,在ASP.NET WEB应用程序中怎样设计时间等待,例如,在某个事件中有for循环,我想让它每执行完一次循环后等待1秒,然后接着执行. 希望高手指点!
{
// Create Bitmap and Graphics objects
Bitmap curBitmap = new Bitmap("d:\\ASP_Web\\123.jpg");
Graphics g = Graphics.FromImage(curBitmap);
// Create pen
Pen pen = new Pen(Color.Red, 3);
//Draw line on the graphics
g.DrawLine(pen,0,0,100,100);
curBitmap.Save(this.Response.OutputStream,ImageFormat.Jpeg)
//dispose the graphics
g.Dispose();
}
这是Button内触发的事件,即我希望点击button后在当前页面上显示一幅图片,该图片上有一条直线.但运行后点击button时,图片是在新的页面上显示的,我怀疑是否要将 curBitmap.Save(this.Response.OutputStream,ImageFormat.Jpeg)中的参数Response.OutputStream修改一下,该语句直接将图片输出到新的页面了,但我用Response.writer("字符串")时,是输出在当前页面.
肯请大侠帮忙!!!
不胜感激!!! 另外,在ASP.NET WEB应用程序中怎样设计时间等待,例如,在某个事件中有for循环,我想让它每执行完一次循环后等待1秒,然后接着执行. 希望高手指点!
用thread,也可以用timer
我觉得应该可以实现你的想法。
对于等待,在Web应用程序中,设置thread后显示的是最终的结果,根本看不到动态效果.用timer好象也没有反应,不知道是什么原因?
你们好!能不能给点代码?我实在是太菜了.
我试了好多次,显示的都是最后的结果.
比如,for(int i=0;i<5;i++)
{
Response.Write(i.ToString());
System.Threading.Thread.Sleep(1000);
}
运行时大概过了5秒后,屏幕上就一下子显示的是01234,根本不是我想要的0(间隔1秒)1(间隔1秒)2(间隔1秒)3(间隔1秒)4而用timer时,设interval为1秒,
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
Response.Writer("a");
}
屏幕上根本没有变化.
而在windows应用程序中我能实现.我不知道怎么设置static,还望指点迷津,不胜感激!!!
如有代码,可发到我Email:[email protected]
或者参考
http://www.cnblogs.com/lovecherry/archive/2005/04/10/135060.html