请各位看一下下面这段代码,调试的时候发现程序根本就执行for循环,为什么会这样的?是不是这样写有问题?
btnCount := 1;
with TButton.Create(Self) do
begin
for I := 0 to ComponentCount-1 do
if Components[I] is TButton then
Inc(btnCount);
Parent := Form1;
Name := 'Button' + inttostr(btnCount);
Top := Button1.Top + 10;
Left := Button1.Left + 10;
DragMode := dmAutomatic;
end;
btnCount := 1;
with TButton.Create(Self) do
begin
for I := 0 to ComponentCount-1 do
if Components[I] is TButton then
Inc(btnCount);
Parent := Form1;
Name := 'Button' + inttostr(btnCount);
Top := Button1.Top + 10;
Left := Button1.Left + 10;
DragMode := dmAutomatic;
end;
解决方案 »
- delphi 鼠标画图 退出后如何清除所画的痕迹?
- 请问如果不装delphi的开发环境,在哪里能找到delphi的文档
- 怎样识别图片文件类型
- 如何让程序在后台执行时显示gif图片?急
- 用hook拦截键盘输入,怎么判断左右shift,ctrl?
- 把以前写好的DELPHI程序转成OCX控件(包含FORM等多个控件),怎样做最简单?
- 我想在program Project1中使用idsmtp和idmessage组件,为什么一运行就出错!
- ****请问socket怎么实现多个客户端(同时)向同一服务器传送不同文件??up也有分****
- 開發方法﹐高手給點思路﹗
- 各位用Access做后端时,使用什么前端?
- sendmessage能够模拟出按shift点击某控件(如TButton)吗?
- TClientSocket 在win2000下不能通信!!!
不好意思,打错了,应该是“调试的时候发现程序根本就不执行for循环”。
if Self.Components[I] is TButton then
Inc(btnCount);