2014年5月30日 星期五
unit test;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Spin;
type
TForm1 = class(TForm)
Button2: TButton;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
Button3: TButton;
Button4: TButton;
procedure Button2Click(Sender: TObject);
procedure Label1MouseEnter(Sender: TObject);
procedure Label1MouseLeave(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage('Hello..World')
end;
procedure TForm1.Label1MouseEnter(Sender: TObject);
begin
label1.Font.Color := clRed
end;
procedure TForm1.Label1MouseLeave(Sender: TObject);
begin
label1.font.color := ClBlack
end;
//顥示訊息
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(Edit1.text)
end;
//計算累加
procedure TForm1.Button3Click(Sender: TObject);
var i,sum: integer;
begin
sum := 0;
for i:= SpinEdit1.Value to SpinEdit2.value do sum :=sum + i ;
Showmessage (InttoStr(sum));
end;
// 計算偶數
procedure TForm1.Button4Click(Sender: TObject);
var i,sum: integer;
begin
sum := 0;
for i:= SpinEdit1.Value to SpinEdit2.value do if (i mod 2 = 0) then sum :=sum + i ;
Showmessage (InttoStr(sum));
end;
end.
標籤: software
0 意見:
張貼留言