4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Delphi】MessageDlg() でアイコンが表示されない

Last updated at Posted at 2025-04-10

はじめに

12 Athens で MessageDlg() を使うと mtInformationmtConfirmation を指定したダイアログでアイコンが表示されません。

  MessageDlg('Hello,world.', TMsgDlgType.mtWarning     , [mbOK], -1);
  MessageDlg('Hello,world.', TMsgDlgType.mtError       , [mbOK], -1);
  MessageDlg('Hello,world.', TMsgDlgType.mtInformation , [mbOK], -1);
  MessageDlg('Hello,world.', TMsgDlgType.mtConfirmation, [mbOK], -1);

image.png

image.png

image.png

image.png

See also:

背景

要は Microsoft のガイドラインに基づく変更で「確認ダイアログにアイコンを使うな!」という事らしいです。

従来の挙動に戻すには

アイコンを従来の挙動に戻すにはグローバル配列変数 MsgDlgIcons[] を操作します。

12 Athens では初期状態で次のように設定されているので、

TMsgDlgType TMsgDlgIcon
mtWarning mdiWarning
mtError mdiError
mtInformation mdiNone
mtConfirmation mdiNone
mtCustom mdiNone

11.3 Alexandria 相当にするには次のコードを追加します。

  MsgDlgIcons[TMsgDlgType.mtInformation]  := TMsgDlgIcon.mdiInformation;
  MsgDlgIcons[TMsgDlgType.mtConfirmation] := TMsgDlgIcon.mdiWarning;

image.png

image.png

image.png

image.png

11.2 Alexandria 相当にするには次のコードを追加します。

  MsgDlgIcons[TMsgDlgType.mtInformation]  := TMsgDlgIcon.mdiInformation;
  MsgDlgIcons[TMsgDlgType.mtConfirmation] := TMsgDlgIcon.mdiInformation;

この問題は UseLatestCommonDialogs を False に設定しても解決しません。

See also:

昔話

Windows 3.1 のダイアログとアイコンです。アイコンの色はすべて異なっていました。

image.png

image.png

image.png

image.png

おわりに

いや、アイコンあった方がよくない?前も似たような理由で疑問符アイコン無くした 1 よね?

See also:

  1. Windows Vista 以降のガイドライン

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?