?? modifypasswordu.pas
字號:
unit ModifyPasswordU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TModifyPasswordF = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
EditOld: TEdit;
StaticText2: TStaticText;
StaticText3: TStaticText;
EditNew: TEdit;
StaticText4: TStaticText;
EditConfirm: TEdit;
StaticText5: TStaticText;
GroupBox3: TGroupBox;
BitBtn2: TBitBtn;
StaticText1: TStaticText;
BitBtn1: TBitBtn;
Image1: TImage;
Image2: TImage;
Image3: TImage;
procedure BitBtn2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure EditOldKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure EditConfirmKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPAINT;
public
{ Public declarations }
end;
var
ModifyPasswordF: TModifyPasswordF;
implementation
uses MainU,DataModule,ShareU;
{$R *.dfm}
procedure TModifyPasswordF.WMNCPaint(var Msg: TWMNCPaint);
begin
inherited;
draw(ModifyPasswordF);
end;
procedure TModifyPasswordF.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TModifyPasswordF.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ModifyPasswordf:=nil;
action:=cafree;
end;
procedure TModifyPasswordF.FormCreate(Sender: TObject);
begin
caption:='密碼修改';
Icon:=mainf.Icon;
StaticText1.Caption:=CurUser;
end;
procedure TModifyPasswordF.BitBtn1Click(Sender: TObject);
begin
if editold.Text='' then
begin
application.MessageBox('請輸入舊密碼!','提示!');
editold.SetFocus;
exit;
end
else
if not dm.CheckUserPassword(CurUser,trim(editold.Text)) then
begin
application.MessageBox('輸入錯誤的密碼,請重新輸入!','提示!');
editold.SetFocus;
exit;
end;
if editnew.Text='' then
begin
application.MessageBox('請輸入新密碼!','提示!');
editnew.SetFocus;
exit;
end
else if editconfirm.Text='' then
begin
application.MessageBox('請確認新密碼!','提示!');
editconfirm.SetFocus;
exit;
end
else
if editnew.Text<>editconfirm.Text then
begin
application.MessageBox('確認密碼輸入錯誤,請重新出入!','提示!');
editconfirm.SetFocus;
exit;
end;
if dm.ModifyPassword(CurUser,trim(editnew.Text)) then
begin
application.MessageBox('成功修改密碼!','提示!');
close;
end
else
begin
application.MessageBox('修改密碼失敗,請重新修改!','提示!');
editnew.Text:='';
editold.Text:='';
editconfirm.Text:='';
end;
end;
procedure TModifyPasswordF.EditOldKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key=vk_down) or (key=13) then
begin
selectnext(activecontrol,true,true);
if activecontrol is tedit then
(activecontrol as tedit).SelectAll;
end
else if (key=vk_up) then
begin
selectnext(activecontrol,false,true);
if activecontrol is tedit then
(activecontrol as tedit).SelectAll;
end
else
key:=0;
end;
procedure TModifyPasswordF.EditConfirmKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if key=13 then BitBtn1Click(Sender);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -