怎么控制?
解决方案 »
- 尋找打開UG\PROE\SOILDWORKS文件的方法,急用!!!
- 上海地区招聘Delphi程序员
- 【探讨】把DELPHI的一代码话翻译成C++ builder的。
- 怎样取得本地机器在网络上的名称?(局域网内)
- 加急!! 高分求pb7.0运行库!!!!!!!!!!!!!
- 关于RxDBRichedit控件和字符串的COPY的使用。
- win98默认安装带不带DCOM98,如果不带,哪里可以得到DCOM98,另win98系统能否作应用服务器?
- 大家快来抢分啊!
- 要通过FTP取得一个文件,DELPHI中有控件么?
- 自定义问题
- delphi &符号的问题
- dll问题,程序主体与DLL,DLL与DLL共享变量等,附源码
DownCount:Integer;labelClick(Sender:Tobject)
begin
label1.caption:=Inttostr(DownCount);
inc(DownCount);
end;
全局变量也很好
i 定义为全局变量,不断自增if i mod 2=1 then
label1.caption:='01'
if i mod 2 =0 then
label.caption:='02'
DownCount:Integer; (全局变量)
if(DownCount>2) then
begin
DownCount:=0;
label1.caption:=Inttostr(DownCount);
inc(DownCount);
end
else
if (DownCount<=2) then
begin
label1.caption:=Inttostr(DownCount);
inc(DownCount);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := IntToStr(3 - StrToIntDef(Label1.Caption, 2));
end;
不用增加新的变量。
星星就是星星啊。
学习了。
谢谢。
jadeluo的代码确实简洁。
前面加个‘0’:
Label1.Caption :='0'+IntToStr(3 - StrToIntDef(Label1.Caption,2));
或者
Label1.Caption :=IntToHex(3 - StrToIntDef(Label1.Caption,2));
Label1.Caption :=IntToHex(3 - StrToIntDef(Label1.Caption,2),2);
lable1.caption = '02'
else lable1.caption = '01;
begin
label1.caption := '0' + inttostr(Tag mod 2 + 1);
tag := tag + 1 ;
end;