📄 showuser.~pas
字号:
unit ShowUser;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls;
type
TFrm_ShowUser = class(TForm)
Lb1: TLabel;
Lb3: TLabel;
Lb4: TLabel;
Lb5: TLabel;
Lb6: TLabel;
Lb7: TLabel;
Bevel1: TBevel;
LB11: TLabel;
LB22: TLabel;
LB33: TLabel;
LB44: TLabel;
LB55: TLabel;
LB66: TLabel;
LB77: TLabel;
Btn_Close: TButton;
Timer1: TTimer;
StatusBar1: TStatusBar;
Lb2: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure Btn_CloseClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_ShowUser: TFrm_ShowUser;
implementation
uses sys_global ;
{$R *.dfm}
var
iTime: Dword=0 ;
function GetHourMinuteSec(M: Dword): string ;
var
h, n, s: Dword ;
begin
h := m div 3600;
n := (m - h*3600) div 60 ;
s := m-h*3600-n*60 ;
result := intTostr(h)+'小时'+intTostr(n)+'分钟'+intTostr(s)+'秒'
end ;
function GetHourMinute(M: integer): string ;
var
h, n: integer ;
begin
h := m div 60 ;
n := m mod 60 ;
result := intTostr(h)+'小时'+intTostr(n)+'分钟'
end ;
procedure TFrm_ShowUser.FormShow(Sender: TObject);
begin
if m_ICtype='5' then m_StMoney := 0 ; // use by failer
if m_ICtype='4' then begin
LB22.Caption := '' ;
Lb5.Caption := '上机前时数:' ;
Lb6.Caption := '已用时数:' ;
Lb7.Caption := '剩余时数:' ;
end else begin
Lb5.Caption := '上机前金额:' ;
Lb6.Caption := '已用金额:' ;
Lb7.Caption := '剩余金额:' ;
end;
case strToint(m_ICtype) of
1: Lb11.Caption := '普通卡' ;
2: Lb11.Caption := '金卡' ;
3: Lb11.Caption := '银卡' ;
4: Lb11.Caption := '计时卡' ;
5: Lb11.Caption := '管理卡' ;
end;
Timer1Timer(Sender);
timer1.Enabled := true;
end;
procedure TFrm_ShowUser.Timer1Timer(Sender: TObject);
var
x: real ;
tm: Dword ;
begin
timer1.Enabled:=false; // 暂停TIMER1
if (m_ICtype<>'5') and ((m_ictype='4') and (m_ICMoney < 5)
or (m_ictype<>'4') and (m_icmoney<1)) then begin //若卡上金额少于1元, 报警
if m_ictype='4' then
caption := ' '+ '警告: 您的可上机时间, 已不足5分钟 !'
else
caption := ' '+ '警告: 您卡上的余额, 已不足1元 !' ;
Timer1.Interval:= 500 ;
Frm_ShowUser.Color := clred ;
FlashWindow(Frm_ShowUser.Handle,true)
end else begin
caption := ' 关注您的费用' ;
Frm_ShowUser.Color := clGradientActiveCaption ;
Timer1.Interval:= 1000 ;
end;
x := m_Rate*3600000/m_montime ;
if (m_ictype='4') or (m_ictype='5') then
LB22.Caption := ''
else
LB22.Caption := floatTostr(0.1*int(10*(x+0.05))) + ' 元/小时' ;
LB33.Caption := FormatDateTime('ddddd',m_StartTime)+#13+FormatDateTime('AMPM hh:nn:ss',m_StartTime);
tm := (GetTickCount div 1000) - m_StartMin ;
LB44.caption := GetHourMinuteSec(tm) ;
if m_ICtype <> '4' then begin
LB55.Caption := floatTostrf(m_StMoney,ffnumber,6,2) +' 元';
LB66.Caption := floatTostrf((m_StMoney-m_ICMoney),ffnumber,6,2)+' 元';
LB77.Caption := floatTostrf(m_ICMoney,ffnumber,6,2)+' 元' ;
end else begin
LB55.Caption := GetHourMinute(Trunc(m_StMoney)) ;
LB66.Caption := GetHourMinute(Trunc(m_StMoney-m_ICMoney)) ;
LB77.Caption := GetHourMinute(Trunc(m_ICMoney)) ;
end;
iTime := iTime + 1000 ;
timer1.Enabled:=true ; // 激活计时器
end;
procedure TFrm_ShowUser.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Timer1.Enabled := false ;
end;
procedure TFrm_ShowUser.Btn_CloseClick(Sender: TObject);
begin
close;
end;
procedure TFrm_ShowUser.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key=VK_F12) or (key=VK_ESCAPE) then close ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -