More and more websites now like to develop verification codes, which can be basically achieved in all languages. Today I am writing a C!
Using System;
Using System. Collections;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Web;
Using System. Web. SessionState;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. HtmlControls;
Using System. Drawing. Imaging;
Using System. Drawing. Drawing2D;
// Create a bitmap object
Public void randomNumber ()
{
Bitmap newBitmap = new Bitmap (36,16, PixelFormat. Format32bppArgb );
// Create a drawing surface based on the previously created bitmap object
Graphics g = Graphics. FromImage (newBitmap );
// Fill the rectangle with the specified color
G. FillRectangle (new SolidBrush (Color. White), new Rectangle ));
// Create a font object
Font textFont = new Font ("Times New Roman", 10 );
// Create a RectangleF structure to specify a region
RectangleF rectangle = new RectangleF (0, 0, 36, 16 );
// Create a random number object
Random rd = new Random ();
// Obtain a random number
Int valationNo = 1000 + rd. Next (8999 );
// Fill the area of the rectangle specified by the RectangleF structure with the specified color
G. FillRectangle (new SolidBrush (Color. BurlyWood), rectangle );