初次上機 自己胡亂寫了一個可以改變窗體背景色程序。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
form1.Caption:='紅色背景'; //窗口標題
form1.Color:=clred //窗體顏色改變
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Caption:='白色背景';
form1.Color:=clwhite
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
form1.Caption:='藍色背景';
form1.Color:=clblue
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
form1.Caption:='黃色背景';
form1.Color:=clyellow
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
form1.Caption:='綠色背景';
form1.Color:=clgreen
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
form1.Close
end;
end.
第一次用它編了個小代碼,心裡還是挺高興的。