Professionallearn.com

[ Log On ]
< <
 

Free Source Code C#

Submitted by:P.R.S
11/5/2012 12:00:00 AM
Language: Asp/Asp.net

Step 1 Create a CaptchaImage.cs

using System;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Drawing.Imaging;

using System.Drawing.Text;

 

namespace CaptchaImage

{

      /// <summary>

      /// Summary description for CaptchaImage.

      /// </summary>

      public class CaptchaImage

      {

            // Public properties (all read-only).

            public string Text

            {

                  get { return this.text; }

            }

            public Bitmap Image

            {

                  get { return this.image; }

            }

            public int Width

            {

                  get { return this.width; }

            }

            public int Height

            {

                  get { return this.height; }

            }

 

            // Internal properties.

            private string text;

            private int width;

            private int height;

            private string familyName;

            private Bitmap image;

 

            // For generating random numbers.

            private Random random = new Random();

 

            // ====================================================================

            // Initializes a new instance of the CaptchaImage class using the

            // specified text, width and height.

            // ====================================================================

            public CaptchaImage(string s, int width, int height)

            {

                  this.text = s;

                  this.SetDimensions(width, height);

                  this.GenerateImage();

            }

 

            // ====================================================================

            // Initializes a new instance of the CaptchaImage class using the

            // specified text, width, height and font family.

            // ====================================================================

            public CaptchaImage(string s, int width, int height, string familyName)

            {

                  this.text = s;

                  this.SetDimensions(width, height);

                  this.SetFamilyName(familyName);

                  this.GenerateImage();

            }

 

            // ====================================================================

            // This member overrides Object.Finalize.

            // ====================================================================

Read more...

Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Sponsor