基本信息
源码名称:delphi生成验证码
源码大小:2.23M
文件格式:.rar
开发语言:Pascal
更新时间:2019-09-02
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
生成验证码。

function GetVerificationCode(ACanvas: TCanvas): string;
var
  i, LIndex, LLeft: Integer;
  LPoint: TPoint;
begin
  Result := '';
  for i := 1 to 4 do
  begin
    Randomize;
    LIndex := Random(36);
    Result := Result Trim(C_Arr_Chars[LIndex])
  end;

  LLeft := 10;
  for i := 1 to Length(Result) do
  begin
    ACanvas.Font.Size := Random(10) 9;
    ACanvas.Font.Color := RGB(Random(256) and $C0, Random(256) and $C0, Random(256) and $C0);
    if Random(2) = 1 then
      ACanvas.Font.Style := [fsBold]
    else
      ACanvas.Font.Style := [fsItalic];
    begin
      ACanvas.Font.Name := Screen.Fonts[10];
      LPoint.X := Random(4) LLeft;
      LPoint.Y := Random(5);
      ACanvas.Brush.Style := bsClear;
      ACanvas.TextOut(LPoint.X, LPoint.Y, Result[i]);
      LLeft := LPoint.X ACanvas.TextWidth(Result[i]);
    end;
  end;
end;