ygm8611 2016-03-17 13:36 采纳率: 0%
浏览 1560

Delphi中我在Form里新建了一个Button用来关闭exe应用程序。

Delphi中我在Form里新建了一个Button用来关闭exe应用程序。
然后我要求点击按钮有提示问是否要删除,另外点击Form上的关闭按钮也要有一样的提示
如何做?

  • 写回答

1条回答

  • threenewbee 2016-03-17 15:20
    关注
    procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      case Application.MessageBox('确定退出系统?','询问',35) of
        6:
          begin
            ShowMessage('按了是,窗口关闭');
            CanClose:=True;
          end;
        7:
          begin
            ShowMessage('按了否,返回登陆窗口');
            CanClose:=True;
            //这里写上你的登陆窗口调用代码
            ShowMessage('登陆窗口出现了');
          end;
        2:
          begin
            ShowMessage('按了取消,窗口不关闭');
            CanClose:=False;
          end;
      end;
    end; 
    

    在你的按钮上也写form.Close();

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入