2
我只是好奇,爲什麼你可以刪除窗體上的TSQLConnection
,它會增加Left
和Top
性質的.dfm
:(TSQLConnection)爲什麼Left和Top屬性僅在.dfm文件中可用?
object Form1: TForm1
...
object SQLConnection1: TSQLConnection
Left = 8
Top = 8
end
end
但是,當你在代碼中創建它的Left
和Top
性能不
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;
編譯:
[DCC Error] Unit1.pas(30): E2003 Undeclared identifier: 'Left'
[DCC Error] Unit1.pas(31): E2003 Undeclared identifier: 'Top'
的
TSQLConnection
類的成員
爲什麼某些房產只能在.dfm
中轉讓?您是否不能分配以(.dfm
)形式設置的代碼(.pas
)中的所有屬性?
僅供參考 - 用Delphi XE2(更新3)
謝謝。 +1指向'classes.pas'和'DefineProperties'。 –
+1。就像一個註釋:你會發現這非常可視化控件('TDataSource',ADO組件等)。它們沒有運行時可見性,所以它們沒有位置信息的實際屬性。 IDE添加僞位置(頂部和左側),以便在設計時顯示在適當的位置。 –