Jam*_* L. 2 delphi components runtime
我只是好奇为什么你可以删除一个TSQLConnection表单,它将添加Left和Top属性.dfm:
object Form1: TForm1
...
object SQLConnection1: TSQLConnection
Left = 8
Top = 8
end
end
Run Code Online (Sandbox Code Playgroud)
但是当您在代码中创建它时,Left和Top属性不是TSQLConnection该类的成员:
interface
type
TForm1 = class(TForm)
SQLConnection1: TSQLConnection;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FSQLCon: TSQLConnection;
public
{ Public declarations }
end;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
FSQLCon := TSQLConnection.Create(Self);
FSQLCon.Left := 280;
FSQLCon.Top := 200;
end;
Run Code Online (Sandbox Code Playgroud)
编译:
[DCC Error] Unit1.pas(30): E2003 Undeclared identifier: 'Left'
[DCC Error] Unit1.pas(31): E2003 Undeclared identifier: 'Top'
Run Code Online (Sandbox Code Playgroud)
为什么有些属性仅适用于.dfm?你不能分配.pas在form(.dfm)中设置的所有属性吗?
仅供参考 - 使用Delphi XE2(更新3)
TComponent 的属性Left和Top实际上并不存在.在ReadProperty和使用的DefineProperties中为设计器设置WriteProperties.
看看classes.pas.
| 归档时间: |
|
| 查看次数: |
291 次 |
| 最近记录: |