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

标签 delphi dialog delphi-10.1-berlin

在 Delphi 10.1.2 Berlin 中,在 Vcl.Dialogs.MessageDlg 函数中,DlgType 常量 mtInformationmtConfirmation 创建相同的对话框图标。例如:

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

enter image description here

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

enter image description here

但是 DlgType 常量 mtConfirmation 不应该显示一个问号 图标(与其他 DlgType 一样)常量 mtWarningmtError 创建各自不同的图标)?

如何使用 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?',  mtConfirmation, mbOKCancel, 0) = mrOk then
  begin
    RemoveTheSelectedItem;
  end;

产生这个结果:

enter image description here

关于delphi - DlgType mtConfirmation 常量的 MessageDlg 图标错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46724943/

相关文章:

delphi - 为什么我的 TFrame "seeing"不是已发布的消息?

java - 我的 try catch 没有显示警告消息

multithreading - 如何从Parallel.For循环线程写访问字符串变量?

delphi - 我无法在 tidhttpServer 中获取请求的来源

delphi - 如何正确解码 Google Translate API 答案?

c# - 从页面文件读取/写入

forms - Flutter - 在点击 TextFormField 时显示对话框 NumberPicker

android - 使用 TStyleBook 时的旧/暗对话框

delphi - 搜索数据后,使DBGrid单元格改变颜色

java - DialogFragment 上的 Android setLayoutDirection