鱼C论坛

 找回密码
 立即注册
查看: 2649|回复: 0

[争议讨论] 红绿灯(三)

[复制链接]
发表于 2012-3-6 16:01:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
做了三个圆代表三个灯,比之前的多一个灯,但用if语句一直不得法,现在终于成功了:
我是先设定第一、二个灯为不可见,但不理解是不是顺序的问题而导致成功性。
代码如下:
procedure TForm1.Button1Click(Sender: TObject);
  var
    a:boolean;
    b:boolean;
begin
     a:=true;
     b:=false;
     if shape1.visible=b and shape3.visible=a and shape2.visible=b then
     begin
       shape1.Visible:=a;
       shape2.Visible:=b;
       shape3.Visible:=b;
       end
     else if shape2.visible=b and shape1.visible=a and shape3.visible=b then
     begin
       shape1.Visible:=b;
       shape2.Visible:=a;
       shape3.Visible:=b;
       end
     else
       begin
         shape1.Visible:=b;
         shape2.Visible:=b;
         shape3.Visible:=a;
         end;
end;
end.

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-9-21 08:55

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表