密码登录框--第一篇正式博文
代码如下:
unit Upassword; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Label1: TLabel; Label2: TLabel; Edit2: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin {内部可以隐含一个超级密码} if ( trim(Edit2.text) = 'aini') or (trim(Edit2.text) = '11112222') then ShowMessage('密码正确') else begin ShowMessage('密码错误'); Edit2.SetFocus; // Form1.activecontrol; end; end; procedure TForm1.Button2Click(Sender: TObject); begin close; end; {显示隐藏密码} procedure TForm1.Button3Click(Sender: TObject); begin if Edit2.passwordChar ='*' then begin Edit2.PasswordChar :=#0; button3.caption :='隐藏密码'; end else begin Edit2.PasswordChar :='*'; button3.caption :='显示密码'; end; end; end.

 
                    
                
                
            
        
浙公网安备 33010602011771号