private void Page_Load(object sender, System.EventArgs e) { Bitmap b = new Bitmap(600,600); Graphics g = Graphics.FromImage(b);//GDI+中最重要的类 g.Clear(Color.Red); Pen p = new Pen(Color.Green,3.0f);//铅笔 g.DrawLine(p,0,0,600,600); g.DrawLine(p,600,0,0,600); g.DrawEllipse(p,0,0,100,100); SolidBrush sb = new SolidBrush(Color.Blue);//固体刷 g.FillEllipse(sb,100,100,200,200); g.FillRectangle(sb,300,300,100,100); Font f = new Font("宋体",40);//字体 g.DrawString("哈哈,不错!",f,sb,0,300); Point[] arrP = new Point[5];//point为基本的点 arrP[0] = new Point(200,200); arrP[1] = new Point(200,400); arrP[2] = new Point(500,400); arrP[3] = new Point(500,600); arrP[4] = new Point(300,600); g.DrawPolygon(p,arrP); b.Save(Response.OutputStream,ImageFormat.Gif);
ContentType
one image type!
然后可以用.net相关的类 Or gdi pluscodeproject.com
{
Bitmap b = new Bitmap(600,600);
Graphics g = Graphics.FromImage(b);//GDI+中最重要的类
g.Clear(Color.Red);
Pen p = new Pen(Color.Green,3.0f);//铅笔
g.DrawLine(p,0,0,600,600);
g.DrawLine(p,600,0,0,600);
g.DrawEllipse(p,0,0,100,100);
SolidBrush sb = new SolidBrush(Color.Blue);//固体刷
g.FillEllipse(sb,100,100,200,200);
g.FillRectangle(sb,300,300,100,100);
Font f = new Font("宋体",40);//字体
g.DrawString("哈哈,不错!",f,sb,0,300);
Point[] arrP = new Point[5];//point为基本的点
arrP[0] = new Point(200,200);
arrP[1] = new Point(200,400);
arrP[2] = new Point(500,400);
arrP[3] = new Point(500,600);
arrP[4] = new Point(300,600);
g.DrawPolygon(p,arrP);
b.Save(Response.OutputStream,ImageFormat.Gif);