我在timer的事件里这样写
var
xh:integer//定义一个全局变量
procedure TClient.Timer5Timer(Sender: TObject);
pdc:HDC;
i,j:integer;
begin
pdc:=GetDc(0);
for i:=400 to 450 do
for j:=300 to 350 do
begin
if Getpixel(pdc,i,j)=0 then
begin
timer5.enablid:=false;//终止当前这个记时器
timer6.enabled:=true;//跳转到另外一个记时器里
break;//退出整个for循环
end;
end;
xh:=xh+1;
if xh=1 then setcursorpos(30,30)
else if xh=2 then setcursorpos(40,40)
else if xh=3 then setcursorpos(50,50)
else if xh=4 then
begin
xh:=0
timer5.enablid:=false;
timer6.enablid:=true;
end;
end;
_________________________________
我要实现的是.
当timer5的记时器开启时.让for以及if同时循环.
当for里的Getpixel(pdc,i,j)=0为真时.直接timer5停止.然后跳转到我要做事的timer6里.如果for里的Getpixel(pdc,i,j)=0不真的话.当if的xh+到4的时候.也是停止timer5.在跳转到timer6里.
////
试了一个晚上
我在打开这个记时器的时候.整个系统就停顿了一下.我觉得是for的问题..要等3~5秒才会恢复正常.但是我用vb写的话.一切正常.大家帮小弟解决一下.(代码临时在这里写的.如果代码那里错了.莫见怪.我只是想知道是那里出问题.让系统会停顿.)
var
xh:integer//定义一个全局变量
procedure TClient.Timer5Timer(Sender: TObject);
pdc:HDC;
i,j:integer;
begin
pdc:=GetDc(0);
for i:=400 to 450 do
for j:=300 to 350 do
begin
if Getpixel(pdc,i,j)=0 then
begin
timer5.enablid:=false;//终止当前这个记时器
timer6.enabled:=true;//跳转到另外一个记时器里
break;//退出整个for循环
end;
end;
xh:=xh+1;
if xh=1 then setcursorpos(30,30)
else if xh=2 then setcursorpos(40,40)
else if xh=3 then setcursorpos(50,50)
else if xh=4 then
begin
xh:=0
timer5.enablid:=false;
timer6.enablid:=true;
end;
end;
_________________________________
我要实现的是.
当timer5的记时器开启时.让for以及if同时循环.
当for里的Getpixel(pdc,i,j)=0为真时.直接timer5停止.然后跳转到我要做事的timer6里.如果for里的Getpixel(pdc,i,j)=0不真的话.当if的xh+到4的时候.也是停止timer5.在跳转到timer6里.
////
试了一个晚上
我在打开这个记时器的时候.整个系统就停顿了一下.我觉得是for的问题..要等3~5秒才会恢复正常.但是我用vb写的话.一切正常.大家帮小弟解决一下.(代码临时在这里写的.如果代码那里错了.莫见怪.我只是想知道是那里出问题.让系统会停顿.)
解决方案 »
- 服务程序的问题:一个service应用程序能否运行两个实例?
- 学习中:在DELPHI中如何实现数据三层结构呀??能说详细点最好,谢谢!!比如说要用那些控件工程来做如DATAMODAL等
- 在线等 急
- 谁有Power-Designer 9 Studio的注册码??给一个啊,谢谢!
- 关于"透明窗体"的研究和再讨论
- 如何通过ascii码得到键盘值(不好意思只有10分了请帮帮忙)?
- 菜鸟问题
- FastReport一問?
- 得到当前计算机名称的函数是什么?
- combo box有设置显示字符串对应值得地方吗?
- 关于登录窗口的问题。
- 请教大侠:ado+access,数据库里面单精度类型,我设置了小数位数为两位。可是读到dbgrid里面后,小数有一长串!请问如何去掉?
问了一些人
原来和线程有关系.
不知道有没有什么方法可以解决这个代码运算的问题?