如何在对话框中自定义图标图像

时间:2012-07-16 23:09:14

标签: c# winforms dialog showdialog

我使用按钮单击事件来调用对话框,如下所示:

private void btnDialog_Click(object sender, EventArgs e)
    {
    DialogResult result = BetterDialog.ShowDialog("Special Dialog", "large heading", "small explanation", null, "Ok", ***null***);
    if (result == DialogResult.OK)
    {
    // Action to perform ...
    }
    }

如何指定给定文件夹中的图标图像以显示在对话框上?

1 个答案:

答案 0 :(得分:1)

尝试:

private void btnDialog_Click(object sender, EventArgs e)
{
   DialogResult result = BetterDialog.ShowDialog("Special Dialog", "large heading", "small explanation", null, "Ok", Image.FromFile(@"fullPath\FileName.ext"));
   if (result == DialogResult.OK)
   {
   // Action to perform ...
   }
}

但它会改变对话框内的图像,(如果你想改变对话框标题的图标 - 我认为没有修改BetterDialog代码就不可能)