interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls
type
TForm1 = class(TForm)
Panel1: TPanel
SpeedButton1: TSpeedButton
SpeedButton2: TSpeedButton
SpeedButton3: TSpeedButton
SpeedButton4: TSpeedButton
SpeedButton5: TSpeedButton
SpeedButton6: TSpeedButton
SpeedButton7: TSpeedButton
SpeedButton8: TSpeedButton
SpeedButton9: TSpeedButton
SpeedButton10: TSpeedButton
SpeedButton11: TSpeedButton
SpeedButton12: TSpeedButton
SpeedButton13: TSpeedButton
SpeedButton14: TSpeedButton
SpeedButton15: TSpeedButton
SpeedButton16: TSpeedButton
SpeedButton17: TSpeedButton
SpeedButton18: TSpeedButton
SpeedButton19: TSpeedButton
SpeedButton20: TSpeedButton
SpeedButton21: TSpeedButton
SpeedButton22: TSpeedButton
SpeedButton23: TSpeedButton
SpeedButton24: TSpeedButton
Edit1: TEdit
procedure FormCreate(Sender: TObject)
procedure SpeedButton18Click(Sender: TObject)
procedure SpeedButton1Click(Sender: TObject)
procedure SpeedButton2Click(Sender: TObject)
procedure SpeedButton3Click(Sender: TObject)
procedure SpeedButton4Click(Sender: TObject)
procedure SpeedButton7Click(Sender: TObject)
procedure SpeedButton8Click(Sender: TObject)
procedure SpeedButton9Click(Sender: TObject)
procedure SpeedButton10Click(Sender: TObject)
procedure SpeedButton13Click(Sender: TObject)
procedure SpeedButton14Click(Sender: TObject)
procedure SpeedButton24Click(Sender: TObject)
procedure SpeedButton5Click(Sender: TObject)
procedure SpeedButton16Click(Sender: TObject)
procedure SpeedButton6Click(Sender: TObject)
procedure SpeedButton11Click(Sender: TObject)
procedure SpeedButton12Click(Sender: TObject)
procedure SpeedButton15Click(Sender: TObject)
procedure SpeedButton23Click(Sender: TObject)
procedure SpeedButton19Click(Sender: TObject)
procedure SpeedButton20Click(Sender: TObject)
procedure SpeedButton21Click(Sender: TObject)
private
{ Private declarations }
public
{ Public declarations }
end
var
Form1: TForm1
flog: integer
temp1: string
temp2: real
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject)
begin
edit1.Clear//程序运行时自动清空文本编辑窗口
end
procedure TForm1.SpeedButton18Click(Sender: TObject)
begin
end
procedure TForm1.SpeedButton1Click(Sender: TObject)
begin// 单击按钮1时 ,文本编辑框中显示1
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'1'
end
procedure TForm1.SpeedButton2Click(Sender: TObject)
begin // 单击按钮2时 ,文本编辑框中显示2
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'2'
end
procedure TForm1.SpeedButton3Click(Sender: TObject)
begin // 单击按钮3时 ,文本编辑框中显示3
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'3'
end
procedure TForm1.SpeedButton4Click(Sender: TObject)
begin// 单击按钮4时 ,文本编辑框中显示4
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'4'
end
procedure TForm1.SpeedButton7Click(Sender: TObject)
begin // 单击按钮5时 , 文本编辑框中显示5
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'5'
end
procedure TForm1.SpeedButton8Click(Sender: TObject)
begin // 单击按钮6时 , 文本编辑框中显示6
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'6'
end
procedure TForm1.SpeedButton9Click(Sender: TObject)
begin // 单击按钮7时 , 文本编辑框中显示7
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'7'
end
procedure TForm1.SpeedButton10Click(Sender: TObject)
begin// 单击按钮8时 , 文本编辑框中显示8
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'8'
end
procedure TForm1.SpeedButton13Click(Sender: TObject)
begin // 单击按钮9时 , 文本编辑框中显示9
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'9'
end
procedure TForm1.SpeedButton14Click(Sender: TObject)
begin// 单击按钮0时 , 文本编辑框中显示0
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'0'
end
procedure TForm1.SpeedButton15Click(Sender: TObject)
begin// 单击按钮.时 ,文本编辑框中显示.
if form1.SpeedButton17.Caption='关闭' then
edit1.Text:=edit1.Text+'.'
end
procedure TForm1.SpeedButton24Click(Sender: TObject)
begin
edit1.Clear// 复位键,按下该键时文本编辑框清空
end
procedure TForm1.SpeedButton16Click(Sender: TObject)
begin // 加减乘除四则运算
case flog of
1: temp2:=strtofloat(edit1.Text)+strtofloat(temp1)
2: temp2:=strtofloat(temp1)-strtofloat(edit1.Text)
3: temp2:=strtofloat(temp1)*strtofloat(edit1.Text)
4: temp2:=strtofloat(temp1)/strtofloat(edit1.text)
end
edit1.Text:=floattostr(temp2)
end
procedure TForm1.SpeedButton5Click(Sender: TObject)
begin // 加法运算
flog:=1
temp1:=edit1.text
edit1.Clear
end
procedure TForm1.SpeedButton6Click(Sender: TObject)
begin // 减法运算
flog:=2
temp1:=edit1.Text
edit1.Clear
end
procedure TForm1.SpeedButton11Click(Sender: TObject)
begin// 乘法运算
flog:=3
temp1:=edit1.Text
edit1.Clear
end
procedure TForm1.SpeedButton12Click(Sender: TObject)
begin // 除法运算
flog:=4
temp1:=edit1.Text
edit1.Clear
end
procedure TForm1.SpeedButton23Click(Sender: TObject)
var// 单击按钮+/-时 ,对文本编辑框中的数进行求反运算
real1: real
begin
real1:=strtofloat(form1.Edit1.Text)
if (real1>0)=true then
form1.Edit1.Text:=floattostr((-1)*(real1))
else
form1.Edit1.Text:=floattostr(abs(real1))
end
procedure TForm1.SpeedButton19Click(Sender: TObject)
var
real3:real
begin //正弦函数按钮,按下对文本编辑框中的数字求正弦值
real3:=strtofloat(form1.Edit1.Text)
if (180-real3)>0=true then
form1.Edit1.Text:=floattostr(sin(((real3)/180)*3.1415926))
else
form1.Edit1.Text:=floattostr(sin((-1)*(((real3)/180)*3.1415926)))
end
procedure TForm1.SpeedButton20Click(Sender: TObject)
var
real4:real
const
pi=3.1415926
begin//余弦函数按钮,当按下按钮时对文本编辑框中的文字求余弦
real4:=strtofloat(form1.Edit1.Text)
if (180-real4)>0=true then
form1.Edit1.Text:=floattostr(cos((-1)*(((real4)/180)*3.1415926)))
else
form1.Edit1.Text:=floattostr(cos(((real4)/180)*3.1415926))
end
procedure TForm1.SpeedButton21Click(Sender: TObject)
var
real5:real
begin // 正切函数,当按下此键时对文本框中的数字求正切
real5:=strtofloat(form1.Edit1.Text)
if (90>real5)and(real5>0)=true then
form1.Edit1.Text:=floattostr(((real5/90)*3.1415926))
end
end.
从indy clients组件面板中拖一个idftp组件, 然携御猜后在按钮中拆誉写如下代码 idftp1.host := '192.168.0.1'//ftp服务器的ip地址 idftp1.username := '***'//登录ftp服务器的用户名 idftp1.password := '***'//登录ftp服务器的密码 idftp1.port := '21'//端口号默认为21,如果不更改则不加此行代码 if IdFTP1.Connected then IdFTP1.Disconnectbegin try IdFTP1.Connect()except showmessage('FTP链接失败!')exitendend //开始上传 idftp1.put('需上传文件的目录名','需上传文件的文件名'辩型,false)//开始下载 idftp1.get('ftp服务器目录','存放本地目录名',如果文件存在是否覆盖已存在文件,是否重命名文件名)欢迎分享,转载请注明来源:内存溢出
评论列表(0条)