工作中点滴记录

永远保持学徒心态

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

public Bitmap CreateBitmap()

{

Response.ContentType="image/jpeg";

Bitmap bitmap=new Bitmap(100,30);

Graphics graphics =Graphics.FromImage(bitmap);

Random random =new Random();

for(int i =0;i<30;i++)

{

int x1 = random.Next(100);

int x2 =random.Next(100);

int y1 =random.Next(30);

int y2 = random.Next(30);

graphics.DrawLine(new Pen(Color.Black,1), new Point(x1,y1),new Point(x2,y2));

}

graphics.Flush();

return bitmap;

}

 

调用段:

Bitmap  bitmap= CreateBitmap();

bitmap.Save(Response.OutputStream,ImageFormat.Jpeg);

posted on 2011-05-11 23:11  梦里故乡  阅读(344)  评论(0编辑  收藏  举报