1. 创建位图对象
Bitmap bmp = new Bitmap(150, 40);
2. 根据位图对象创建GDI对象
Graphics g = Graphics.FromImage(bmp);
3.随机生成一个5位数的字符串
Random r = new Random();
string str = null;
for (int i = 0; i < 5; i++)
{
int rNumber = r.Next(0, 10);
str += rNumber;
}
4.将字符串中的字符依次取出,并为其染上不同颜色,定位不同坐标,定义不同字体风格
for (int i = 0; i < 5; i++)
{
Point p = new Point(i*15,0);
string[] fonts = { "微软雅黑", "宋体", "黑体", "隶书", "仿宋" };
Color[] colors = {Color.Red, Color.Green, Color.Blue,Color.Yellow,