📄 inputmoneyunit.~pas
字号:
unit InputMoneyUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls, Mask, ExtCtrls, jpeg;
type
TGetMoneyForm = class(TForm)
MaskEdit1: TMaskEdit;
TitelLabel: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ComboBox1: TComboBox;
Label1: TLabel;
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
GetMoneyForm: TGetMoneyForm;
Tit:string;
function GetMoney(T:PChar):double;stdcall;
Procedure MyShow(S:PChar);stdcall;
implementation
{$R *.dfm}
Procedure MyShow(S:PChar);stdcall;
begin
MessageBox(0,S,'',mb_OK);
end;
function GetMoney(T:PChar):double;stdcall;
var
Temp:string;
begin
Result:=0.00;
if MessageBox(0,T,'确认',MB_YesNo
+MB_DEFBUTTON1+MB_IconAsterisk+MB_ApplModal)=IDYES then
begin
try
GetMoneyForm:= TGetMoneyForm.Create (Application);
try
with GetMoneyForm do
begin
if ShowModal = mrOK then
begin
Caption:=T;
Temp:=MaskEdit1.Text;
try
Result:=StrToFloat(Temp);
except on E:EConvertError do
MessageDlg ('输入错误:'+E.Message, mtError,[mbOK],0);
end;
end;
end;
finally
GetMoneyForm.Free;
end;
except on E: Exception do
MessageDlg ('DLL出现错误:'+E.Message, mtError,[mbOK],0);
end;
end;
end;
procedure TGetMoneyForm.ComboBox1Change(Sender: TObject);
begin
case ComboBox1.ItemIndex of
0: MaskEdit1.EditMask:='!90.00;1;' ;
1: MaskEdit1.EditMask:='!990.00;1;';
2: MaskEdit1.EditMask:='!9990.00;1;';
3: MaskEdit1.EditMask:='!99990.00;1;';
end;
MaskEdit1.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -