use*_*348 6 delphi dialog delphi-10.1-berlin
在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;
Run Code Online (Sandbox Code Playgroud)
if Vcl.Dialogs.MessageDlg('Do you really want to remove the selected item?', mtInformation, mbOKCancel, 0) = mrOk then
begin
RemoveTheSelectedItem;
end;
Run Code Online (Sandbox Code Playgroud)
但不应该DlgType常数mtConfirmation显示一个问号图标,(作为其他DlgType常量mtWarning并mtError创建每个不同的图标)?
如何使用常量获得问号图标?DlgTypemtConfirmation
Tom*_*erg 11
在帮助中说:
让mtConfirmation显示问号
TMsgDlgType.mtConfirmation类型的对话框显示信息图标.
在过去,他们过去常常显示问号,但Microsoft从Windows API函数中删除了问号符号,VCL使用该函数来显示TMsgDlgType.mtConfirmation对话框.引用微软:"不再推荐使用问号消息图标,因为它不能清楚地表示特定类型的消息,并且因为消息作为问题的措辞可以应用于任何消息类型.此外,用户可能会混淆消息带有帮助信息的符号问号." 要使用先前的对话框外观,必须将Vcl.Dialogs单元的UseLatestCommonDialogs变量设置为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;
Run Code Online (Sandbox Code Playgroud)
产生这个结果: