新入手DELPHI,以后就是这里的常客啦,请教问题先! 本帖最后由 s27566 于 2010-07-26 10:51:45 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没看明白button的click事件中加入以下一行代码就行了label1.visible=not label1.visble;如果非要在两个button里写就把label1.visible=true;label1.visible=false;分别写在两个button的click事件里 隐藏用self.label1.visible:=false;显示用self.label1.visible:=true;用timer显示系统时间self.label1.caption:=formatdatetime('yyyy-MM-dd HH:mm:ss',now); 就是我写了个label1里面用计时器获取时间显示在上面我又加了两个按钮(隐藏、显示) 当我点隐藏按钮的时候 label1里面就什么都不显示我在Button1(隐藏)里面加了这么一段label1.caption :='';但是label1因为用了计时器一秒一更新,所以只是隐藏一秒后时间又被刷出来了所以我想用循环判断另外一个显示按钮,如果没有被点击,那label1.caption :='';这句话就一直执行! 啊 2楼正解 都不要判断什么循环了,我好笨哦 对DELPHI极度不了解呀不过还是想问下,我3楼说的那个循环,能实现吗? 还有,如果我想把显示和隐藏都集成在一个按钮上,可以实现吗?procedure TForm1.Button2Click(Sender: TObject); //显示begin self.label1.visible:=true;end;procedure TForm1.Button3Click(Sender: TObject); //隐藏begin self.label1.visible:=false;end; procedure TFrm.Button1Change(Sender: TObject);begin Button1.visible:=False; Button2.visible:=True; Timer1.Enabled:=True;end;procedure TFrm.Button2Change(Sender: TObject);begin Button2.visible:=False; Button1.visible:=True; Timer1.Enabled:=False;end;procedure TFrm.Timer1Timer(Sender: TObject);begin label1.caption:=formatdatetime('yyyy-MM-dd HH:mm:ss',now); end;事件中加入以下一行代码就行了label1.visible=not label1.visble;如果非要在两个button里写就把label1.visible=true;label1.visible=false;分别写在两个button的click事件里 比如,你是用timer这个组件来刷新的话,在你点击隐藏按钮的时候,在按钮事件里加上:timer.visible:=False;在显示按钮的事件上加上:timer.visible:=True; 改成:procedure TForm1.Button2Click(Sender: TObject);begin if Button2.caption='隐藏' then begin Button2.caption:='显示' self.label1.visible:=False; end else begin Button2.caption:='隐藏' self.label1.visible:=true; end;end; 我居然关闭不窗口,关闭窗口有那么难么?? 数据插入的怪问题 晕死,定义了一个Stream:TBlobStream;系统居然提示Undeclared identifier:'TBlobStream' 高手求救,高分在线等 SQl : 当update大量数据时,出现服务器超时错误该怎么处理? 让你的企业、产品、网站一夜成名 请教IE的接口问题 有人说学习Delphi是学习编程语言成本最高的一个,请大家品品…… intraweb 编程问题! 大家平常做帮助文档和安装程序都用什么啊? 为什么画不出线条啊? 哪位用InterBase数据库,求教。
button的click事件中加入以下一行代码就行了
label1.visible=not label1.visble;如果非要在两个button里写就把
label1.visible=true;
label1.visible=false;
分别写在两个button的click事件里
self.label1.visible:=false;
显示用
self.label1.visible:=true;用timer显示系统时间
self.label1.caption:=formatdatetime('yyyy-MM-dd HH:mm:ss',now);
begin
self.label1.visible:=true;
end;procedure TForm1.Button3Click(Sender: TObject); //隐藏
begin
self.label1.visible:=false;
end;
begin
Button1.visible:=False;
Button2.visible:=True;
Timer1.Enabled:=True;
end;procedure TFrm.Button2Change(Sender: TObject);
begin
Button2.visible:=False;
Button1.visible:=True;
Timer1.Enabled:=False;
end;procedure TFrm.Timer1Timer(Sender: TObject);
begin
label1.caption:=formatdatetime('yyyy-MM-dd HH:mm:ss',now);
end;事件中加入以下一行代码就行了
label1.visible=not label1.visble;如果非要在两个button里写就把
label1.visible=true;
label1.visible=false;
分别写在两个button的click事件里
timer.visible:=False;
在显示按钮的事件上加上:
timer.visible:=True;
改成:procedure TForm1.Button2Click(Sender: TObject);
begin
if Button2.caption='隐藏' then
begin
Button2.caption:='显示'
self.label1.visible:=False;
end else begin
Button2.caption:='隐藏'
self.label1.visible:=true;
end;
end;