刚才问时没说明白,就是让lael显示在01和02两个数值之间,点第三次时显示01依次类推……我的表达能力差不知道大家明白没有?----------------- i 定义为全局变量,不断自增if i mod 2=1 then label1.caption:='01' if i mod 2 =0 then label.caption:='02'
那更简单 if Label1.Caption = '01' then Label1.Caption = '02' else Label1.Caption = '01';
procedure TForm1.Button1Click(Sender: TObject); begin if label1.Caption ='01' then label1.Caption :='02' else label1.Caption :='01';end; 给楼上说不得一样。
全局变量也很好
i 定义为全局变量,不断自增if i mod 2=1 then
label1.caption:='01'
if i mod 2 =0 then
label.caption:='02'
if Label1.Caption = '01' then
Label1.Caption = '02'
else
Label1.Caption = '01';
begin
if label1.Caption ='01' then
label1.Caption :='02'
else
label1.Caption :='01';end;
给楼上说不得一样。
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := IntToStr(3 - StrToIntDef(Label1.Caption, 2));
end;