我也需要一个Delphi7制作的计数器 源程序 请求您的帮助
2个回答
展开全部
你就在知道里搜索一下计算器就行,前二个月,我写了一个,是源代码,不过那人没有采纳我的.四则运算是可以的
补上全部源代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Edit1: TEdit;
procedure Button15Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ysf:word;
yss1:currency=0;yss2:currency=0;
implementation
{$R *.dfm}
procedure TForm1.Button15Click(Sender: TObject);
begin
edit1.Text:=copy(edit1.Text,1,length(edit1.Text)-1);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if edit1.Text <>'' then
edit1.Text :=edit1.Text+'0';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'1';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'2';
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'3';
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'4';
end;
procedure TForm1.Button12Click(Sender: TObject);//此按钮上的标签是数字5,余类推
begin
edit1.Text :=edit1.Text+'5';
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'6';
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'7';
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'8';
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'9';
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
if pos('.',edit1.Text)=0 then
edit1.Text := edit1.Text+'.';
end;
procedure TForm1.Button18Click(Sender: TObject);//此按钮为清除按钮
begin
yss1:=0;
yss2:=0;
edit1.Text:='';
end;
procedure TForm1.Button7Click(Sender: TObject);//以下四个按钮是四个运算符号按钮
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=0;
edit1.Text:='';
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=1;
edit1.Text:='';
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=2;
edit1.Text:='';
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=3;
edit1.Text:='';
end;
procedure TForm1.Button17Click(Sender: TObject);//这是等于按钮
begin
if edit1.Text ='' then
exit;
yss2:=strTocurr(edit1.Text);
case ysf of
0:edit1.Text:=currTostr(yss1+yss2);
1:edit1.Text:=currTostr(yss1-yss2);
2:edit1.Text:=currTostr(yss1*yss2);
3:begin
if (yss1=0) or (yss2=0) then
begin
showmessage('违反运算规则!');
exit;
end;
edit1.Text:=currTostr(yss1/yss2);
end;
end;
end;
end.
补上全部源代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Edit1: TEdit;
procedure Button15Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ysf:word;
yss1:currency=0;yss2:currency=0;
implementation
{$R *.dfm}
procedure TForm1.Button15Click(Sender: TObject);
begin
edit1.Text:=copy(edit1.Text,1,length(edit1.Text)-1);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if edit1.Text <>'' then
edit1.Text :=edit1.Text+'0';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'1';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'2';
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'3';
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'4';
end;
procedure TForm1.Button12Click(Sender: TObject);//此按钮上的标签是数字5,余类推
begin
edit1.Text :=edit1.Text+'5';
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'6';
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'7';
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'8';
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
edit1.Text :=edit1.Text+'9';
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
if pos('.',edit1.Text)=0 then
edit1.Text := edit1.Text+'.';
end;
procedure TForm1.Button18Click(Sender: TObject);//此按钮为清除按钮
begin
yss1:=0;
yss2:=0;
edit1.Text:='';
end;
procedure TForm1.Button7Click(Sender: TObject);//以下四个按钮是四个运算符号按钮
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=0;
edit1.Text:='';
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=1;
edit1.Text:='';
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=2;
edit1.Text:='';
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
if edit1.Text <>'' then
yss1:=strTocurr(edit1.Text)
else
exit;
ysf:=3;
edit1.Text:='';
end;
procedure TForm1.Button17Click(Sender: TObject);//这是等于按钮
begin
if edit1.Text ='' then
exit;
yss2:=strTocurr(edit1.Text);
case ysf of
0:edit1.Text:=currTostr(yss1+yss2);
1:edit1.Text:=currTostr(yss1-yss2);
2:edit1.Text:=currTostr(yss1*yss2);
3:begin
if (yss1=0) or (yss2=0) then
begin
showmessage('违反运算规则!');
exit;
end;
edit1.Text:=currTostr(yss1/yss2);
end;
end;
end;
end.
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询