加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 错误的MessageDlg图标与DlgType mtConfirmation常量?

发布时间:2020-12-15 04:17:59 所属栏目:大数据 来源:网络整理
导读:在Delphi 10.1.2 Berlin中,在Vcl.Dialogs.MessageDlg函数中,DlgType常量mtInformation和mtConfirmation创建相同的对话框图标.例如: if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?',mtConfirmation,mbOKCancel,0) = mrOk the
在Delphi 10.1.2 Berlin中,在Vcl.Dialogs.MessageDlg函数中,DlgType常量mtInformation和mtConfirmation创建相同的对话框图标.例如:
if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?',mtConfirmation,mbOKCancel,0) = mrOk then
begin
  RemoveTheSelectedItem;
end;

if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?',mtInformation,0) = mrOk then
begin
  RemoveTheSelectedItem;
end;

但是DlgType常量mtConfirmation不应该显示问号图标,(因为其他DlgType常量mtWarning和mtError会创建一个不同的图标)?

如何使用DlgType常量mtConfirmation获取问号图标?

解决方法

据说在 help:

Having mtConfirmation Show a Question Mark

Dialog boxes of TMsgDlgType.mtConfirmation type show an information
icon.

In the past,they used to show a question mark instead,but Microsoft
removed the question mark symbol from the Windows API function that
the VCL uses to display TMsgDlgType.mtConfirmation dialog boxes.
Quoting Microsoft: “The question-mark message icon is no longer
recommended because it does not clearly represent a specific type of
message and because the phrasing of a message as a question could
apply to any message type. In addition,users can confuse the message
symbol question mark with Help information.” To use the previous
dialog box appearance,you must set the UseLatestCommonDialogs
variable of the Vcl.Dialogs unit to False.

所以这段代码:

Vcl.Dialogs.UseLatestCommonDialogs := False;
  if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?',0) = mrOk then
  begin
    RemoveTheSelectedItem;
  end;

产生这个结果:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读