偶的第二个Delphi程序
2006-02-04 14:00:57 来源:WEB开发网unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
PRocedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
const pi=3.14159;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var r,c,s:real;
begin
if edit1.text='' then
showmessage('输入为空,请重新输入!') //如果没有输入数据 则提示
else
begin
r:=strtofloat(edit1.text);
c:=2*pi*r;
s:=pi*sqr(r);
label2.Caption:='该圆的周长是:'+floattostr(c)+chr(13)+'面积是:'+floattostr(s); //显示结果
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Close; //退出按钮的事件代码
end;
end.
- ››程序员 不妨都写一写前端代码
- ››Delphi实现把10进制转换成16进制的函数进制转化
- ››Delphi中将字符串按给定字符分隔(似split函数功能...
- ››Delphi 动态创建窗体,锁定窗口赋值
- ››Delphi 与 VC 共享接口和对象
- ››Delphi图像处理 -- 表面模糊
- ››Delphi之多线程实例
- ››Delphi SelectSingleNode的使用 根据节点属性获取...
- ››Delphi接口详述
- ››delphi 远程调试
- ››Delphi与DirectX之DelphiX(34): TDIB.Lightness()...
- ››Delphi Application.MessageBox详解
赞助商链接