读书人

求注解,该怎么处理

发布时间: 2012-04-03 12:38:19 作者: rapoo

求注解
For i := 0 to Self.ComponentCount - 1 do
If Self.Components[i] is tdbEdit then
tdbedit(Self.Components[i]).Readonly := True
else If Self.Components[i] is tdbCombobox then
tdbCombobox(Self.Components[i]).Readonly := True;

[解决办法]
用FOR遍历SELF下的控件,SELF默认为FORM
如果控件是tdbEdit(输入框)或者下拉列表框(dbCombobox)----》》设置其为只读属性
[解决办法]
循环窗体/容器/其它(Self代表什么就是什么)中的组件
判断是不是tdbEdit类
是,设定它的Readonly为true
不是tdbEdit类,再判断是不是tdbCombobox类
是,设定它的Readonly为true

tdbedit(Self.Components[i])是强制转换,也可以这样写:(Self.Components[i] as tdbedit)

读书人网 >.NET

热点推荐