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);

相关文章:

  • 2021-04-17
  • 2022-12-23
  • 2021-11-28
  • 2021-09-25
  • 2021-11-30
  • 2022-02-28
  • 2022-12-23
  • 2022-02-10
猜你喜欢
  • 2021-06-27
  • 2022-02-08
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案