passnull.pas
来自「一个关于VCD销售的系统」· PAS 代码 · 共 350 行
PAS
350 行
unit passnull;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Menus, ComCtrls, ToolWin, Buttons, StdCtrls, AppEvnts,
LabelButton, TradeImage, MaskImageButton, MoveImageButton;
type
Tfrm_passnull = class(TForm)
palUp: TPanel;
palLeftUp: TPanel;
imgLeftUp: TImage;
palRightUp: TPanel;
imgRightUp: TImage;
palUpMid: TPanel;
imgCaption: TImage;
palDown: TPanel;
imgLeftDown: TImage;
imgRightDown: TImage;
imgDownMin: TImage;
palLeft: TPanel;
palRight: TPanel;
imgRight: TImage;
imgCloseButton: TImage;
imgMinButton: TImage;
imgSizeButton: TImage;
imgMaxButton: TImage;
imgRestoreButton: TImage;
imgSysIcon: TImage;
popSystemMenu: TPopupMenu;
N_Restore: TMenuItem;
N_Max: TMenuItem;
N_Min: TMenuItem;
N_Move: TMenuItem;
N_Size: TMenuItem;
N_Speater: TMenuItem;
N_Close: TMenuItem;
palClient: TPanel;
lbCaption: TLabel;
CoolBarMenu: TCoolBar;
ToolBarMenu: TToolBar;
imgLeft: TImage;
imgColorLeftUp: TImage;
imgGrayCaption: TImage;
imgGrayMenuBar: TImage;
imgGrayRightUp: TImage;
imgColorCaption: TImage;
imgGrayLeftUp: TImage;
imgColorRightUp: TImage;
imgRightUp1: TImage;
imgLeftUp1: TImage;
imgColorMenubar: TImage;
GroupBox1: TGroupBox;
Label6: TLabel;
e_zl_name: TEdit;
Label9: TLabel;
e_zl_zlx: TEdit;
Label7: TLabel;
e_zl_sex: TEdit;
Label10: TLabel;
e_zl_yj: TEdit;
Label11: TLabel;
e_zl_tel: TEdit;
Label8: TLabel;
e_zl_nl: TEdit;
Label1: TLabel;
e_zl_zh: TEdit;
e_zl_addr: TEdit;
Label2: TLabel;
b_ok: TMoveImgBtn;
blabel_ok: TLabelBtn;
b_exit: TMoveImgBtn;
blabel_exit: TLabelBtn;
procedure imgMinButtonClick(Sender: TObject);
procedure imgSizeButtonClick(Sender: TObject);
procedure imgCloseButtonClick(Sender: TObject);
procedure imgCaptionMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure imgCaptionMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure imgCaptionMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure imgSysIconMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure popSystemMenuPopup(Sender: TObject);
procedure N_SizeClick(Sender: TObject);
procedure N_MoveClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure e_zl_zhExit(Sender: TObject);
procedure e_zl_zhChange(Sender: TObject);
procedure b_okClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure b_exitClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
canmove:boolean;
curPoint:TPoint;
oldPoint:TPoint;
Canvas:TCanvas;
protected
procedure CreateParams(var Params:TCreateParams);override;
procedure WMActivate(var Msg:TWMACTIVATE); message WM_ACTIVATE;
public
{ Public declarations }
end;
var
frm_passnull: Tfrm_passnull;
implementation
uses datam, passyz;
{$R *.dfm}
procedure Tfrm_passnull.CreateParams(var Params:TCreateParams);
begin
inherited CreateParams(Params);
if BorderStyle<>bsNone then
Params.Style :=WS_THICKFRAME or WS_POPUP or WS_BORDER;
end;
procedure Tfrm_passnull.imgMinButtonClick(Sender: TObject);
begin
if Application.MainForm =self then
Application.Minimize
else
DefWindowProc(Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
end;
procedure Tfrm_passnull.imgSizeButtonClick(Sender: TObject);
begin
if self.WindowState = wsNormal then
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
imgSizeButton.Picture :=imgRestoreButton.Picture;
end
else
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
imgSizeButton.Picture :=imgMaxButton.Picture;
end;
end;
procedure Tfrm_passnull.imgCloseButtonClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_CLOSE, 0);
end;
procedure Tfrm_passnull.imgCaptionMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button=mbLeft)and(ssLeft in Shift)then
begin
canmove:=true;
Canvas:=TCanvas.Create;
with Canvas do
begin
pen.Style :=psdot;
brush.Style :=bsClear;
pen.Width :=2;
Pen.Mode :=pmNotXor;
Handle :=GetDC(0);
Rectangle(left,top,Left+width,top+height);
curPoint.X :=X;
curPoint.Y :=Y;
oldPoint.X :=Left;
oldPoint.Y :=Top;
end; //end with
end; //end if
end;
procedure Tfrm_passnull.imgCaptionMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if not canmove then exit;
with Canvas do
begin
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
oldPoint.x :=Left +X-curPoint.x;
oldPoint.y :=Top +Y-curPoint.y;
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
end;
end;
procedure Tfrm_passnull.imgCaptionMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if not canmove then exit;
with Canvas do
begin
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
Left :=oldPoint.x;
Top :=oldPoint.y;
Free;
end;
canmove:=not canmove;
end;
procedure Tfrm_passnull.FormCreate(Sender: TObject);
begin
lbCaption.Caption :=Caption;
end;
procedure Tfrm_passnull.imgSysIconMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PopSystemMenu.Popup(Left+ImgSysIcon.Left,Top+ImgSysIcon.Top+ImgSysIcon.Height);
end;
procedure Tfrm_passnull.popSystemMenuPopup(Sender: TObject);
begin
N_Restore.Enabled :=imgSizeButton.Visible and (WindowState =wsMaximized);
N_Max.Enabled :=imgSizeButton.Visible and (WindowState =wsNormal);
N_Size.Enabled :=imgSizeButton.Visible ;
n_min.Enabled:=imgMinButton.Visible;
end;
procedure Tfrm_passnull.N_SizeClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_SIZE, 0);
end;
procedure Tfrm_passnull.N_MoveClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_MOVE, 0);
end;
procedure Tfrm_passnull.FormShow(Sender: TObject);
begin
if WindowState=wsNormal then
imgSizeButton.Picture.Bitmap :=imgMaxButton.Picture.Bitmap
else if WindowState=wsMaximized then
imgSizeButton.Picture.Bitmap :=imgRestoreButton.Picture.Bitmap;
e_zl_zh.SetFocus();
end;
procedure Tfrm_passnull.WMActivate(var Msg: TWMACTIVATE);
begin
if (Msg.Active =WA_ACTIVE) or (Msg.Active =WA_CLICKACTIVE) then
begin
imgCaption.Picture.Bitmap :=imgColorCaption.Picture.Bitmap;
imgLeftUp1.Picture.Bitmap :=imgColorLeftUp.Picture.Bitmap;
imgRightUp1.Picture.Bitmap :=imgColorRightUp.Picture.Bitmap;
coolBarMenu.Bitmap :=imgColorMenubar.Picture.Bitmap;
end
else begin
imgCaption.Picture.Bitmap :=imgGrayCaption.Picture.Bitmap;
imgLeftUp1.Picture.Bitmap :=imgGrayLeftUp.Picture.Bitmap;
imgRightUp1.Picture.Bitmap :=imgGrayRightUp.Picture.Bitmap;
coolBarMenu.Bitmap :=imgGrayMenubar.Picture.Bitmap;
end;
end;
procedure Tfrm_passnull.e_zl_zhExit(Sender: TObject);
begin
if e_zl_zh.Text='' then exit
else
begin
if Length(e_zl_zh.Text)<5 then
case Length(e_zl_zh.Text) of
1: e_zl_zh.text:='0000'+e_zl_zh.text;
2: e_zl_zh.text:='000'+e_zl_zh.text;
3: e_zl_zh.text:='00'+e_zl_zh.text;
4: e_zl_zh.text:='0'+e_zl_zh.text;
end
end;
dm.ADO_vip.Open;
dm.ADO_vip.First;
if not dm.ADO_vip.Locate('证号',e_zl_zh.Text,[]) then
begin
Application.MessageBox(PChar('证号错误,请重新录入!')
, PChar('提示'),MB_ICONEXCLAMATION);
e_zl_zh.Text:='';
e_zl_zh.SetFocus();
exit;
end;
e_zl_name.Text:=dm.ADO_vip.fieldbyname('姓名').asstring;
e_zl_sex.Text:=dm.ADO_vip.fieldbyname('性别').asstring;
e_zl_nl.Text:=dm.ADO_vip.fieldbyname('年龄').asstring;
e_zl_zlx.Text:=dm.ADO_vip.fieldbyname('证类型').asstring;
e_zl_yj.Text:=dm.ADO_vip.fieldbyname('押金').asstring;
e_zl_tel.Text:=dm.ADO_vip.fieldbyname('电话').asstring;
e_zl_addr.Text:=dm.ADO_vip.fieldbyname('地址').asstring;
end;
procedure Tfrm_passnull.e_zl_zhChange(Sender: TObject);
begin
e_zl_name.Text:='';
e_zl_nl.Text:='';
e_zl_sex.Text:='';
e_zl_zlx.Text:='';
e_zl_yj.Text:='';
e_zl_tel.Text:='';
e_zl_addr.Text:='';
end;
procedure Tfrm_passnull.b_okClick(Sender: TObject);
var
mes:string;
begin
e_zl_name.SetFocus();
mes:='会员<'+dm.ADO_vip.fieldbyname('证号').AsString+' '+
dm.ADO_vip.fieldbyname('姓名').AsString+'>密码已清除!';
if e_zl_name.Text='' then exit;
dm.ADO_vip.Edit;
dm.ADO_vip.FieldByName('pass').AsString:='';
dm.ADO_vip.Post;
application.MessageBox(pchar(mes),pchar('提示'),64);
e_zl_zh.Text:='';
e_zl_name.Text:='';
e_zl_nl.Text:='';
e_zl_sex.Text:='';
e_zl_zlx.Text:='';
e_zl_yj.Text:='';
e_zl_tel.Text:='';
e_zl_addr.Text:='';
e_zl_zh.SetFocus();
end;
procedure Tfrm_passnull.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
dm.ADO_vip.Close;
frm_pass.close;
release;
end;
procedure Tfrm_passnull.b_exitClick(Sender: TObject);
begin
close;
end;
procedure Tfrm_passnull.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
perform(wm_nextdlgctl,0,0);
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?