1 Public Static byte[] Getverifycode (stringcodestr)2 {3Random r =NewRandom ();4Bitmap Btbitmap =NewBitmap ( the, -);5 6Graphics g =graphics.fromimage (btbitmap);7 g.clear (color.white);8 //Draw Interference Lines9 for(inti =0; I < -; i++)Ten { One intX1 =R.next (btbitmap.width); A intY1 =R.next (btbitmap.height); - intx2 =R.next (btbitmap.width); - inty2 =R.next (btbitmap.height); theG.drawline (NewPen (Color.Black), x1,y1,x2,y2); - } - //Draw Interference points - for(inti =0; I < -; i++) + { - intX1 =R.next (btbitmap.width); + intY1 =R.next (btbitmap.height); A Btbitmap.setpixel (X1,y1,color.aqua); at } - //Drawing -g.DrawString (CODESTR,NewFont ("Song Body", -),NewSolidBrush (color.red),0,0); -MemoryStream ms =NewMemoryStream (); - Btbitmap.save (MS, imageformat.gif); - returnMs. ToArray (); in}
C # Generate verification code