计时器设置为10ms响应一次
运算只是简单几句:
procedure timeproc(utimerid, umessage: uint; dwuser, dw1, dw2: dword) stdcall;
var
strmin,strsec,strpercent:string;
begin //计时过程,相当于timer里的ontimer Count:=Count+1;
hr:=Count div 360000;
min:=Count div 6000;
sec:=(Count div 100) mod 60;
percent:=Count mod 100; form1.hour.Caption:=inttostr(hr);
//显示minute
if min<10 then
strmin:='0'+inttostr(min)
else
strmin:=inttostr(min);
form1.minute.Caption:=strmin;
//显示second
if sec<10 then
strsec:='0'+inttostr(sec)
else
strsec:=inttostr(sec);
form1.second.Caption:=strsec;
//显示percent
if percent<10 then
strpercent:='0'+inttostr(percent)
else
strpercent:=inttostr(percent);
form1.percent.Caption:=strpercent;
Application.ProcessMessages;end;几个label的字体随着窗口大小改变而改变
最大化时label上的font为 form.width div 8当同时打开四个程序以上就会出现系统边满,显示不正常,label刷新不及时,有时候会在screen上显示label的内容...
甚至会弹出 acess read adress /write adress等等...开一个窗口不会有事...
运算只是简单几句:
procedure timeproc(utimerid, umessage: uint; dwuser, dw1, dw2: dword) stdcall;
var
strmin,strsec,strpercent:string;
begin //计时过程,相当于timer里的ontimer Count:=Count+1;
hr:=Count div 360000;
min:=Count div 6000;
sec:=(Count div 100) mod 60;
percent:=Count mod 100; form1.hour.Caption:=inttostr(hr);
//显示minute
if min<10 then
strmin:='0'+inttostr(min)
else
strmin:=inttostr(min);
form1.minute.Caption:=strmin;
//显示second
if sec<10 then
strsec:='0'+inttostr(sec)
else
strsec:=inttostr(sec);
form1.second.Caption:=strsec;
//显示percent
if percent<10 then
strpercent:='0'+inttostr(percent)
else
strpercent:=inttostr(percent);
form1.percent.Caption:=strpercent;
Application.ProcessMessages;end;几个label的字体随着窗口大小改变而改变
最大化时label上的font为 form.width div 8当同时打开四个程序以上就会出现系统边满,显示不正常,label刷新不及时,有时候会在screen上显示label的内容...
甚至会弹出 acess read adress /write adress等等...开一个窗口不会有事...
解决方案 »
- 怎么获取大文件的MD5?
- SQL中数据库多文件的问题:
- reportMachine3.0制作的报表,在98下正常,在2000下表头打印不出来,谁遇到过?
- 一个关于dbgrid事件触发的问题。
- delphi程序的数据备份?
- 通过AcroPDF.dll读取PDF
- 请问如何让form有更多的颜色?
- 300分买一个qq,目录先付75分。将qq号与密码发入我的邮箱[email protected]
- Tchart控件的x,y轴如何设定,比如我想让x轴显示月份,y轴显示销售量。实在找不到资料讲这个控件的详细用法了!
- 请问:在一台计算机上如何调试网络数据库程序
- 在delphi7制作插入计算机中已安装的对象!!!!
- 转让《delphi5开发人员指南》
hr:=Count div 360000;
min:=Count div 6000;
这个操作,更不需要做form1.minute.Caption:=strmin;这类的操作
改进...
procedure timeproc(utimerid, umessage: uint; dwuser, dw1, dw2: dword) stdcall;
var
strmin,strsec,strpercent:string;
begin //计时过程,相当于timer里的ontimer percent:=percent+1;
if percent=100 then
begin
percent:=0;
form1.percent.Caption:='00';
sec:=sec+1;
if sec=60 then
begin
sec:=0;
form1.second.Caption:='00';
min:=min+1;
if min=60 then
begin
min:=0;
form1.minute.Caption:='00';
hr:=hr+1;
form1.hour.Caption:=inttostr(hr);
end
else
begin
//显示minute
if min<10 then
strmin:='0'+inttostr(min)
else
strmin:=inttostr(min);
form1.minute.Caption:=strmin;
end;
end
else
begin
//显示second
if sec<10 then
strsec:='0'+inttostr(sec)
else
strsec:=inttostr(sec);
form1.second.Caption:=strsec;
end;
end
else
begin
if percent<10 then
strpercent:='0'+inttostr(percent)
else
strpercent:=inttostr(percent);
form1.percent.Caption:=strpercent;
end;
end;通过这么繁琐的一堆判断,效果有改善,但是不大,打开四个窗口之后还是很慢..我将每10ms响应一次改为100ms响应一次,程序基本上就不怎么耗cpu,运行还很流畅
是不是10ms就没办法再改进了?