我的图标TaskDialog
缺失:
![](https://i.stack.imgur.com/M0YfJ.png)
And in the taskbar:
![](https://i.stack.imgur.com/jivZS.png)
我的代码是这样的:
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 版本here。
知道它们为何缺失以及如何启用它们吗?依赖关系设置如下:
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
我已经找到了解决此问题的方法。显然这是 API 本身的一个错误。
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;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)