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); }
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); }
public CaptchaService(int size) { _captcha = new Captcha(size, size / 2); }
public CaptchaService() { _captcha = new Captcha(); }
public void SetBackgroundColor() { SetBackgroundColor(Captcha.GetRandomColor()); }
public void DrawRandomPixel() { DrawRandomPixel(Captcha.GetRandomColor()); }
public void DrawRandomLine() { DrawRandomLine(Captcha.GetRandomColor(), GetRandomPoint(), GetRandomPoint()); }