这是个很方便的快捷键:
这是Form1的原内容:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
然后我们输入: property Name: string; 然后执行 Ctrl+Shift+C
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
Fa: string;
procedure Seta(const Value: string);
{ Private declarations }
public
{ Public declarations }
property a : string read Fa write Seta;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.Seta(const Value: string);
begin
Fa := Value;
end;
end.
红色部分都是自动生成的。