unit Unit1;

 interface

 uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, bsSkinData, BusinessSkinForm, Mask, bsSkinBoxCtrls, bscalc,
bsSkinCtrls; type
TForm1 = class(TForm)
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;
Button19: TButton;
Button20: TButton;
Button21: TButton;
Button22: TButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinData1: TbsSkinData;
Edit1: TbsSkinEdit;
bsCompressedStoredSkin1: TbsCompressedStoredSkin;
Edit2: TbsSkinEdit;
Edit3: TbsSkinEdit;
Edit4: TbsSkinEdit;
Label1: TLabel;
Button1: TButton;
Button23: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit3Change(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
procedure Edit3Enter(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button19Click(Sender: TObject);
procedure Button20Click(Sender: TObject);
procedure Button21Click(Sender: TObject);
procedure Button22Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure Button23Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations } end; var
Form1: TForm1;
str1:String;
str2:String;
int1:real;
int2:real;
bo:real;
result:real;
implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
begin if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end end; procedure TForm1.FormCreate(Sender: TObject);
begin int1:=;
int2:=;
bo:=;
SetWindowLong(Edit1.Handle,GWL_STYLE,GetWindowLong(Edit1.Handle,GWL_STYLE) or Es_right);
SetWindowLong(Edit2.Handle,GWL_STYLE,GetWindowLong(Edit2.Handle,GWL_STYLE) or Es_right);
SetWindowLong(Edit3.Handle,GWL_STYLE,GetWindowLong(Edit3.Handle,GWL_STYLE) or Es_right);
SetWindowLong(Edit4.Handle,GWL_STYLE,GetWindowLong(Edit4.Handle,GWL_STYLE) or Es_right);
end; procedure TForm1.Button20Click(Sender: TObject);
begin
edit2.Text:='';
edit3.Text:='';
int2:=;
edit4.Text:= FormatFloat('0.00000',/int1) ;
end; procedure TForm1.Button21Click(Sender: TObject);
begin
edit2.Text:='';
edit3.Text:='';
int2:=;
edit4.Text:= FormatFloat('0.00000',Sqrt(int1)) ;
end; procedure TForm1.Button22Click(Sender: TObject);
begin
result:=int1*int2/;
Edit4.Text:=FormatFloat('0.00000',result);
end; procedure TForm1.Button23Click(Sender: TObject);
begin
if bo= then
edit1.Text:=''
else
edit3.Text:=''; end; procedure TForm1.Button2Click(Sender: TObject); begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button3Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button4Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button5Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button6Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button7Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button8Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button9Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Edit1Change(Sender: TObject);
begin
str1:=edit1.Text;
if edit1.Text<>'' then
int1:=strtofloat(edit1.Text)
else
int1:=; end; procedure TForm1.Edit1Enter(Sender: TObject);
begin
bo:=;
end; procedure TForm1.Edit3Change(Sender: TObject);
begin
str2:=edit3.Text;
if edit3.Text<>'' then
int2:=strtofloat(edit3.Text)
else
int2:=; end; procedure TForm1.Edit3Enter(Sender: TObject);
begin
bo:=;
end; procedure TForm1.bsSkinButton1Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button10Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'';
Edit3.Text:=str2;
end
end; procedure TForm1.Button11Click(Sender: TObject);
begin
bo:=;
Edit2.Text:='+';
end; procedure TForm1.Button12Click(Sender: TObject);
begin
bo:=;
Edit2.Text:='-';
end; procedure TForm1.Button13Click(Sender: TObject);
begin
bo:=;
Edit2.Text:='*';
end; procedure TForm1.Button14Click(Sender: TObject);
begin
bo:=;
Edit2.Text:='/';
end; procedure TForm1.Button15Click(Sender: TObject);
begin if Edit2.Text='+' then
begin
result:=int1+int2;
Edit4.Text:=floattostr(result);
end ; if Edit2.Text='-' then
begin
result:=int1-int2;
Edit4.Text:=floattostr(result);
end ;
if Edit2.Text='*' then
begin
result:=int1*int2;
Edit4.Text:=floattostr(result);
end ;
if ( Edit2.Text='/') and (int2<> ) then
begin
result:=int1/int2;
{保留5位小数}
Edit4.Text:=FormatFloat('0.00000',result);
end ; if ( Edit2.Text='/') and (int2= ) then
begin
Application.MessageBox('除数不能为0!','错误提示',MB_OKCANCEL);
end ; end; procedure TForm1.Button16Click(Sender: TObject);
begin bo:=;
Edit1.Text:='';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
int1:=;
int2:=;
result:=;
end; procedure TForm1.Button17Click(Sender: TObject);
begin
if bo= then
edit1.Text:= Copy( edit1.Text, , length( Edit1.text )- ) {截取}
else
edit3.Text:= Copy( edit3.Text, , length( Edit3.text )- ); end; procedure TForm1.Button18Click(Sender: TObject);
begin
if bo= then
begin
str1:=str1+'.';
Edit1.Text:=str1;
end
Else
begin
str2:=str2+'.';
Edit3.Text:=str2;
end
end; procedure TForm1.Button19Click(Sender: TObject);
begin
if bo= then
begin
if int1> then
edit1.Text:='-'+edit1.Text
else
begin
int1:=-strtofloat(edit1.Text);
edit1.Text:=floattostr(int1) ;
end; end else
begin
if int2> then
edit3.Text:='-'+edit3.Text
else
begin
int2:=-strtofloat(edit3.Text);
edit3.Text:=floattostr(int2) ;
end;
end;
end; end.

计算器(delphi)的更多相关文章

  1. Delphi 调用系统中的计算器、记事本、画图软件方法

    1.直接调用    前面uses加 ShellAPI ShellExecute(Handle, 'open', PChar('calc.exe'), nil, nil, SW_SHOW); 2.直接调 ...

  2. delphi 发送Windwos消息控制按钮(控制计算器里的某一个按钮)

    procedure TfrmMain.btnSendClick(Sender: TObject); var hCalc, h1: Cardinal; begin WinExec('calc', SW_ ...

  3. delphi.位操作

    位操作网上有很多介绍,请上网google/baidu,比如: 位操作技巧实例大全: http://blog.csdn.net/g_spider/article/details/5750665 位操作基 ...

  4. 在Delphi中如何控制其它应用程序窗口

    在编写Delphi的应用程序中,常常涉及对其它Windows应用程序的操作.例如,在数据库的管理系统中,财务人员需要使用计算器,即可调用Windows内含的计算器功能,若每次使用,均通过“开始/程序/ ...

  5. delphi 资源文件详解

    delphi资源文件详解 一.引子: 现在的Windows应用程序几乎都使用图标.图片.光标.声音等,我们称它们为资源(Resource).最简单的使用资源的办法是把这些资源的源文件打入软件包,以方便 ...

  6. delphi xe5 android 关于文件大小的几个问答O(∩_∩)O~

    摘自:http://blogs.embarcadero.com/vsevolodleonov/2013/09/19/are-you-asking-about-app-size-by-delphi-fo ...

  7. delphi定义自己的消息

    定义一个消息需要两个步骤: 1.声明一个消息标识符 2.声明一个消息记录类型 一个消息标识符是一个整数大小的常数.Windows自用低于1024的消息,所以当你声明你自己的消息,你应该开始高于这一数字 ...

  8. 初学delphi

    今天女朋友的一门课,要求用delphi 软件编程,内容是一个计算器.当然,这个工作肯定是落在我的头上了. 这个软件是我第一次使用,边自学边进行代码编写,在n多次修改完善之后,终于成形.功能不是很多,跟 ...

  9. Delphi应用程序的调试(五)其他调试工具

    Delphi应用程序的调试(五)其他调试工具 Delphi7中提供了一些附加调试工具来帮助用户检查程序错误.从性能上讲,其中一些工具属于高级调试工具.尽管高级调试工具不像其他工具那样常用,但对于经验丰 ...

随机推荐

  1. 探讨PHP页面跳转几种实现技巧

    PHP被许多程序员用来开发WEB的首选语言.在实际开发中,网站的各项功能都可以通过PHP语言的编写来满足,比如PHP页面跳转这一方法. 探讨PHP变量解析顺序如何获取提交数据 深入解读PHP运行机制 ...

  2. java笔记01-反射

    --2013年7月26日17:56:35 写文章之前,参考了这篇:http://www.cnblogs.com/Quincy/archive/2011/06/19/2084557.html 评价:这个 ...

  3. linux-redhat5找回root密码

    我在虚拟机里装了个redhat(RedhatEnterpriseLinuxASv5.4-x64),也不经常用,偶尔进去用用吧,又把密码忘记了,哎...脑子不好使啊 不知道像ubuntu是不是一样的,还 ...

  4. Adobe Edge Animate –Edge Commons强势来袭,Edge团队开发成为现实

    Adobe Edge Animate –Edge Commons强势来袭,Edge团队开发成为现实 版权声明: 本文版权属于 北京联友天下科技发展有限公司. 转载的时候请注明版权和原文地址. Edge ...

  5. 关闭 Flash 沙箱安全模式,解决浏览器高占用

    经常碰到 Firefox 因 Flash 插件崩溃,到卡饭翻了翻,发现是 Flash 沙箱的问题.原文附带了去沙箱保护的 Flash 插件,可惜版本有点旧,遂自己动手解决. 注意:办法一适用于 [ 安 ...

  6. js函数大全

    js函数集·字符串(String) 1.声明 var myString = new String("Every good boy does fine."); var myStrin ...

  7. C#入门教程(一)–.Net平台技术介绍、C#语言及开发工具介绍-打造C#学习教程

    一.什么是.Net平台? .Net平台是微软搭建的技术平台,技术人员在此平台上进行应用的搭建与开发.它提供了运行所必须的环境.NET Framework类库以及CLR(公共语言运行时).好比我们人类的 ...

  8. Linux 命令 - ftp: 网络文件传输工具

    命令格式 ftp [-pinegvd] [host] 命令参数 -A 传输文件模式为主动模式. -p 传输文件模式为被动模式. -i 关闭交互模式. -n 关闭自动登录功能. -e 不记录历史命令. ...

  9. fresco的源码学习自我总结

    前言 对fresco框架源码的阅读学习,学习优秀的编码方式和较为实用常见设计模式,该篇讲得比较浅,主要是理清三个主要类的之间的关系. 本篇目录 fresco框架的MVC模式 fresco的Drawee ...

  10. DOS批处理命令-注释

    注释是每个程序中不可或缺的(不是对计算机来说,而是对我们这些程序员阅读代码来说) 语法: ①rem 这是批处理的注释命令,rem后面的内容全部是注释 例:rem 这是一行注释 ②:: 批处理遇到以冒号 ...