?? 怎樣在運行時刻動態生成控件 (2000年12月21日).txt
字號:
怎樣在運行時刻動態生成控件? (2000年12月21日)
本站更新 分類: 作者:srw 推薦: 閱讀次數:461
(http://www.codesky.net)
--------------------------------------------------------------------------------
怎樣在運行時刻動態生成控件[可視的和不可視的]
㈠、可視控件:[以下以 TEdit 控件為例]
1.在Form的Public 中定義TEdit控件
Edit1:TEdit;
2.在需要生成的地方加入以下代碼:
Edit1:=TEdit.Create(Self);
Edit1.Parent:=Form1; ?// Set parent to paint the Edit1
Edit1.Left ?:=20; ?// Set postion
Edit1.Top :=20;
Edit1.Text :='Edit1 Text'; // Set values
.... ? // Set other property
3.使用完畢后,釋放分配的資源
if? Assigned(Edit1) then
Edit1.Free; ?
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -