更改ShowMessage对话框的标题和属性 [英] Change caption and attributes of ShowMessage dialog

查看:79
本文介绍了更改ShowMessage对话框的标题和属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Delphi中,您可以更改 ShowMessage 对话框的标题吗,因为默认情况下它使用我的exe名称.

In Delphi can you change the caption of the ShowMessage dialog because by default it is taking my exe name.

我可以更改背景颜色,大小相同吗?

And can I change the background color, size of the same?

推荐答案

您可以使用delphi的 CreateMessageDialog 函数创建自己的自定义对话框.

You can create your own custom dialogs by using delphi's CreateMessageDialog function.

以下示例:

var
  Dlg: TForm;
begin
  Dlg := CreateMessageDialog('message', mtInformation, [mbOk], mbOK);
  // Treat Dlg like any other form

  Dlg.Caption := 'Hello World';

  try
    // The message label is named 'message'
    with TLabel(Dlg.FindComponent('message')) do
    begin
      Font.Style := [fsUnderline];

      // extraordinary code goes here
    end;

    // The icon is named... icon
    with TPicture(Dlg.FindComponent('icon')) do
    begin
      // more amazing code regarding the icon
    end;

    Dlg.ShowModal;
  finally
    Dlg.Free;
  end;

当然,您也可以动态地将其他组件插入该表单中.

and of course you can insert other components aswell into that form dynamically.

这篇关于更改ShowMessage对话框的标题和属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆