窗体内有很多种控件,启动时我想让它显示crHourGlass,包括,Panel里的控件也是这样显示,启动后显示正常
for I := 0 to ComponentCount - 1 do
if Components[I] is TWinControl then
begin
(Components[I] as TLabel).Cursor:=crHourGlass;
(Components[I] as Tdbgrid).Cursor:=crHourGlass;
(Components[I] as Tedit).Cursor:=crHourGlass;
(Components[I] as Tbutton).Cursor:=crHourGlass;
(Components[I] as TstaticText).Cursor:=crHourGlass;
(Components[I] as Tcombobox).Cursor:=crHourGlass;
end;
为何上面的代码运行时会报错呢!!
for I := 0 to ComponentCount - 1 do
if Components[I] is TWinControl then
begin
(Components[I] as TLabel).Cursor:=crHourGlass;
(Components[I] as Tdbgrid).Cursor:=crHourGlass;
(Components[I] as Tedit).Cursor:=crHourGlass;
(Components[I] as Tbutton).Cursor:=crHourGlass;
(Components[I] as TstaticText).Cursor:=crHourGlass;
(Components[I] as Tcombobox).Cursor:=crHourGlass;
end;
为何上面的代码运行时会报错呢!!
解决方案 »
- 怎样为单机版的数据库应用程序设置用户权限?
- 有点小难度(高分相送)
- 小弟也想和大侠换c#程序学习
- 大家来测试一下,看你适合作软件不??
- 紧急求助!!!一个Delphi新手到济南找工作这样的条件可以拿到多少钱??必重谢!!!!
- 菜鸟求助!!delphi7下ShellExecute问题?
- 十万火急:用ClientDataSet1组件将数据存入oracle中出错
- SMTP发送邮件的问题请教
- 请教各位高手关于Excel表格数据自动保存和指定文件夹删除的问题,多谢!
- 在delphi中如何用sql把某个库的数据备份成数据文件(txt或doc文件)??
- 请教一个DateTimePicker1问题!!
- 控件...
for I := 0 to ComponentCount - 1 do
if Components[I] is TWinControl then
begin
TWinControl(Components[I]).Cursor := crHelp;
end;
(Components[I] as TLabel)不同类型转换的时候会有问题
var
I: integer;
begin
for I := 0 to ComponentCount - 1 do
if Components[I] is TWinControl then
begin
(Components[i] as TWinControl).Cursor := crHelp ;
end;
end;
if Components[I] is TWinControl then
begin
if (Components[I] is TLabel) then (Components[I] as TLabel).Cursor:=crHourGlass;
.....
end;
其实不用这么麻烦,直接
Screen.Cursor := crHourGlass;
即可。
俺就这么用的 限定下范围就可以了