delphi随机输入验证码
输入验证码 一个文本框 24字母随机出4个字母 然后用户
输入所随机出的字母 输入正确 进入界面。。错误又随机下。。。
*/
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
lbl1: TLabel;
Edit1: TEdit;
btn1: TButton;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
function ShowRandom:string;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
var
i,j:Integer;
c:Char;
begin
lbl1.Caption:=''; //这个是标签
for j:=0 to 3 do //随机生成4个a到z的字符串
begin
i:=Random(24);
c:=chr(ord('a') + i);
lbl1.Caption:=lbl1.Caption + c;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Randomize;
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
if edit1.Text=lbl1.Caption then //成功
ShowMessage('0k')
else
ShowMessage('error');
end;
function ShowRandom:string;
var
i,j:Integer;
c:Char;
begin
Result:='';
for j:=0 to 3 do //随机生成4个a到z的字符串
begin
Randomize;
i:=Random(24);
c:=chr(ord('a') + i);
Result:=Result + c;
end;
end;
end.
相关文档:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
&n ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
procedure Butt ......
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TDemoForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
GetButton: TBitBtn;
CloseButton: TBitBtn;
Bevel1: TBevel;
Label5: TLabel;
......
flash是macromedia公司出品的,用在互联网上动态的、可互动的shockwave。它的优点是体积小,可边下载边播放,这样就避免了用户长时间的等待。
flash可以用其生成动画,还可在网页中加入声音。这样你就能生成多媒体的图形和界面,而使文件的体积却很小。
flash虽然不可以象一门语言 ......