Label1->Caption=ms+"MS" 显示问题
我在编辑的时候出现奇怪的问题。请指点是什么问题造成?
代码:如果单独“MS”或者,ms可以正常。但是两个加起来就不行。
这应该是格式问题。ms是int 而 MS是字符型。如何让他们两个一起显示?
- C/C++ code
void __fastcall TForm2::Timer1Timer(TObject *Sender){ int ms,mm,dd,hh,tt; for (ms = 0; ms <= 60000; ms=ms+(Timer1->Interval)) { Label1->Caption=ms+"MS"; }}
另外Timer如何控制每一秒刷新一次form?是在onTimer事件里面完成吗?
[解决办法]
- C/C++ code
void __fastcall TForm2::Timer1Timer(TObject *Sender){ int ms,mm,dd,hh,tt; for (ms = 0; ms <= 60000; ms=ms+(Timer1->Interval)) { Label1->Caption = IntToStr(ms) +"MS"; }}