Exemple #1
0
 public void DrawRandomWords()
 {
     string[] strs = new string[4];
     for (int i = 0; i < 4; i++)
     {
         strs[i] = Captcha.GetRandomWord();
         float h = Math.Min((_width - 10) / 4, _height - 10);
         int   x = 5 + (_width - 10) / 4 * i;
         DrawRandomWord(strs[i], "Verdana", h,
                        Captcha.GetRandomColor(255, 255, 0, 255, 0, 255, 0, 255),
                        GetRandomPoint(x, x, 5, 5));
     }
     _code = string.Join("", strs);
 }
Exemple #2
0
        public void CreateCaptcha(string path)
        {
            _captcha.SetBackgroundColor(Captcha.GetRandomColor(255, 255, 255, 255, 255, 255, 255, 255));

            for (int i = 0; i < _captcha.Width / 10; i++)
            {
                _captcha.DrawRandomLine();
            }

            _captcha.DrawRandomWords();

            for (int i = 0; i < _captcha.Width; i++)
            {
                _captcha.DrawRandomPixel();
            }

            _captcha.ImageSave(path);
        }
Exemple #3
0
 public CaptchaService(int size)
 {
     _captcha = new Captcha(size, size / 2);
 }
Exemple #4
0
 public CaptchaService()
 {
     _captcha = new Captcha();
 }
Exemple #5
0
 public void SetBackgroundColor()
 {
     SetBackgroundColor(Captcha.GetRandomColor());
 }
Exemple #6
0
 public void DrawRandomPixel()
 {
     DrawRandomPixel(Captcha.GetRandomColor());
 }
Exemple #7
0
 public void DrawRandomLine()
 {
     DrawRandomLine(Captcha.GetRandomColor(), GetRandomPoint(), GetRandomPoint());
 }