Defines a conditional symbol with the given name. The symbol is recognized for the remainder of the compilation of the current module in which the symbol is declared, or until it appears in an {$UNDEF name} directive. The {$DEFINE name} directive has no effect if name is already defined.
我认为是delphi比较高级的功能,使用该语句可以替代program/options/directorys and conditionals中的条件定义。
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$define test}//you can disable and enable this line to see what happen.you must rebuild the project after you change it
procedure TForm1.Button1Click(Sender: TObject);
begin