Inno Setup-在消息框中隐藏X按钮(关闭) [英] Inno Setup - Hide X button (close) at message box

查看:225
本文介绍了Inno Setup-在消息框中隐藏X按钮(关闭)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在消息框中隐藏X按钮?

如果可能的话,我想看这个

解决方案

我认为这是不可能的.

一种可能的解决方法是从头开始实现消息框.

并从TForm.BorderIcons中删除biSystemMenu(或实际上将其设置为空).

 procedure MyMessageBoxWithoutCloseButton;
var
  Form: TSetupForm;
  Button: TNewButton;
  MesssageLabel: TLabel;
begin
  Form := CreateCustomForm;
  Form.BorderStyle := bsDialog;
  Form.Position := poOwnerFormCenter;
  Form.ClientWidth := ScaleX(400);
  Form.ClientHeight := ScaleY(130);
  Form.BorderIcons := []; { No close button }
  Form.Caption := 'Caption';

  MesssageLabel := TLabel.Create(Form);
  MesssageLabel.Parent := Form;
  MesssageLabel.Left := ScaleX(16);
  MesssageLabel.Top := ScaleX(16);
  MesssageLabel.Width := Form.ClientWidth - 2*ScaleX(16);
  MesssageLabel.Height := ScaleY(32);
  MesssageLabel.AutoSize := False;
  MesssageLabel.WordWrap := True;
  MesssageLabel.Caption := 'Lorem ipsum dolor sit amet, ...';

  Button := TNewButton.Create(Form);
  Button.Parent := Form;
  Button.Width := ScaleX(80);
  Button.Height := ScaleY(24);
  Button.Left := Form.ClientWidth - Button.Width - ScaleX(8);
  Button.Top := Form.ClientHeight - Button.Height - ScaleY(8);
  Button.Caption := 'Accept';
  Button.ModalResult := mrOK;

  Form.ShowModal;
end;
 


请注意,仍然可以使用 Alt-F4 关闭消息框.

为防止该手柄OnCloseQuery.例如,请参见如何删除/隐藏/禁用消息框上的[确定]按钮.

How to hide X button at message box?

I want to see this, if is possible:

解决方案

I do not think this is possible.

One possible workaround is to implement the message box from the scratch.

And remove the biSystemMenu from the TForm.BorderIcons (or actually setting it empty).

procedure MyMessageBoxWithoutCloseButton;
var
  Form: TSetupForm;
  Button: TNewButton;
  MesssageLabel: TLabel;
begin
  Form := CreateCustomForm;
  Form.BorderStyle := bsDialog;
  Form.Position := poOwnerFormCenter;
  Form.ClientWidth := ScaleX(400);
  Form.ClientHeight := ScaleY(130);
  Form.BorderIcons := []; { No close button }
  Form.Caption := 'Caption';

  MesssageLabel := TLabel.Create(Form);
  MesssageLabel.Parent := Form;
  MesssageLabel.Left := ScaleX(16);
  MesssageLabel.Top := ScaleX(16);
  MesssageLabel.Width := Form.ClientWidth - 2*ScaleX(16);
  MesssageLabel.Height := ScaleY(32);
  MesssageLabel.AutoSize := False;
  MesssageLabel.WordWrap := True;
  MesssageLabel.Caption := 'Lorem ipsum dolor sit amet, ...';

  Button := TNewButton.Create(Form);
  Button.Parent := Form;
  Button.Width := ScaleX(80);
  Button.Height := ScaleY(24);
  Button.Left := Form.ClientWidth - Button.Width - ScaleX(8);
  Button.Top := Form.ClientHeight - Button.Height - ScaleY(8);
  Button.Caption := 'Accept';
  Button.ModalResult := mrOK;

  Form.ShowModal;
end;


Note that it's still possible to close the message box using Alt-F4.

To prevent that handle OnCloseQuery. For an example, see How to Delete / Hide / Disable [OK] button on message box.

这篇关于Inno Setup-在消息框中隐藏X按钮(关闭)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆