delphi小疑问
请问如何设置一个按钮,一点到它就不断执行按钮上加载的事件,知道点击另一个按钮才会停止,因为写了个选号的小程序,希望可以像电视上那样,一点就不断的刷 而不是点一下刷一下!!
两种方法
1.用timer去控制执行,两个按钮,一个启动timer,一个停止timer
2.做一个变量,代表是否执行,一个按钮事件中,判断这个变量,如果是false就不执行了
能不能写详细点呢,小弟弟我刚入门不久
选号的代码写在时钟Timer1里,然后通过按钮切换Timer1的Enabled属性
——————————
如果问题解决请及时结帖
timer的做法比较简单
按钮点击事件里
while true do begin
if not next then break;
加载的代码
app****.p***message;
end;
放两个按钮、一个编辑框,和一个时钟(System组件页)。
把时钟的Enabled属性设为False,Interval属性设为100,在OnTimer事件里头写上选号代码,如随机生成1 ~ 100的整数:
Randomize();
Edit1.Text := IntToStr(Trunc(Random(100)) + 1);
按钮1启动时钟,代码如:
Timer1.Enabled := True;
按钮2停止时钟,代码如:
Timer1.Enabled := False;
——————————
如果问题解决请及时结帖
相关问答:
[size=18px]var s,n:integer;
begin
write('输入变长的条数n');
readln(n);
[color=#FF0000]s:=n*(n-1)*(n-2)div 6; //本行替换为s:=n*(n-1)*(n-2)/ ......
我尝试一个 idhttp 访问网站链接的程序
在设置代理端口的时候出错
编译没有错误
就是在运行的时候 出现了
80 is not a valid integer value 的问题
我已经把 函数分类出来的 port 转换为 integer 了 ......
project project3.exe raised exception class ERemotableException with message 'access violation at address 004037B in module'project2.exe'.read of address 00000003'.process stopped.use ......
求 delphi webserivice 调用例子
服务端编写:新建"WebServices-->SOAP Server Application-->ISAPI/NSAPI Dynamic Link Library","Service name"填写你要的服务名,如"SendS ......