带有 DlgType mtConfirmation 常量的错误 MessageDlg 图标?
Wrong MessageDlg icon with DlgType mtConfirmation constant?
在 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, mbOKCancel, 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?', mtConfirmation, mbOKCancel, 0) = mrOk then
begin
RemoveTheSelectedItem;
end;
产生这个结果:
在 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, mbOKCancel, 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?', mtConfirmation, mbOKCancel, 0) = mrOk then
begin
RemoveTheSelectedItem;
end;
产生这个结果: