请大家看看这个编历。里面有些小问题我不明白,送分(20分)

  • 主题发起人 pchddcat
  • 开始时间
P

pchddcat

Unregistered / Unconfirmed
GUEST, unregistred user!
begin
for I := 0 to ComponentCount - 1 do
begin
S := Components.ClassName;//这段是什么意思
if S = 'TEdit' then
TEdit(Components).Text := ''//(Components).是什么意思
else
if S = 'TComboBox' then
TCombobox(Components).ItemIndex := -1;
end;
end;
 
Components.ClassName是这个程序所有的组件的类的名字,
Components)是一个类(TObject),类似于TObject所以要强制转换
 
for I := 0 to ComponentCount - 1 do
// 遍历所有的部件
S := Components.ClassName;
// 取得当前部件的类名
if S = 'TEdit' then
// 如果是 TEDIT
TEdit(Components).Text := ''// 则将此 TEDIT 的 TEXT 清空

 
顶部