使用SolidBrush 单色画笔
Bitmap bitmap = new Bitmap(800, 600);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
SolidBrush mySolidBrush = new SolidBrush(Color.Yellow);
graphics.FillEllipse(mySolidBrush, 70, 20, 100, 50);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif";
Response.BinaryWrite(ms.ToArray());
img派生类的对象->画布->清理画布->声明画笔->画椭圆->把img存到内存流中->二进制数组从服务器发送到浏览器上
使用HatchBrush绘制简单图案
Bitmap bitmap = new Bitmap(200, 100);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
HatchBrush myhatchBrush = new HatchBrush(HatchStyle.BackwardDiagonal, Color.Green, Color.Orange);
graphics.FillEllipse(myhatchBrush, 0, 0, 200, 100);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.ClearContent();
Response.ContentType = "image/Jpeg";
Response.BinaryWrite(ms.ToArray());
img派生类的对象->画布->清理画布->声明画笔->画椭圆->把img存到内存流中->二进制数组从服务器发送到浏览器上