我的TaskDialog中的图标丢失了:

在任务栏中:

我的代码是:
using Microsoft.WindowsAPICodePack;
using Microsoft.WindowsAPICodePack.Dialogs;
...
TaskDialog taskDialog = new TaskDialog();
taskDialog.Caption = "Error";
taskDialog.InstructionText = "Test error message.";
taskDialog.Text = "Icon seems to be missing.";
taskDialog.DetailsExpandedText = "Test";
taskDialog.DetailsCollapsedLabel = "Expand";
taskDialog.StandardButtons = TaskDialogStandardButtons.Ok;
taskDialog.Icon = TaskDialogStandardIcon.Error;
taskDialog.Show();我正在使用来自这里的1.1版本。知道他们失踪的原因以及如何启用他们吗?依赖项设置如下:
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>发布于 2014-03-22 11:00:12
我找到了解决办法。显然,它是API本身的一个bug。
taskDialog.Opened += new EventHandler(taskDialog_Opened);
...
public void taskDialog_Opened(object sender, EventArgs e)
{
TaskDialog taskDialog = sender as TaskDialog;
taskDialog.Icon = taskDialog.Icon;
taskDialog.FooterIcon = taskDialog.FooterIcon;
taskDialog.InstructionText = taskDialog.InstructionText;
}发布于 2016-08-05 15:57:33
我想补充一下这一点,但我没有足够的代表。在删除这一行代码后,标记的答案对我有效:
taskDialog.FooterIcon = taskDialog.FooterIcon;这导致了一个未处理的异常。
https://stackoverflow.com/questions/22561584
复制相似问题