unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
a : String;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{$DEFINE AAA} // 定义行。
procedure TForm1.FormCreate(Sender: TObject);
begin
a := 'Other';
{$IFDEF AAA}
a := 'AAA';
{$ENDIF}
{$IFDEF BBB}
a := 'BBB';
{$ENDIF}
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Caption := a;
end;
end.