gpt4 book ai didi

c# - Windows API 代码包 TaskDialog 缺少图标

转载 作者:可可西里 更新时间:2023-11-01 14:42:44 26 4
gpt4 key购买 nike

我的 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();

我使用的是 here 的 1.1 版.他们为什么失踪以及如何启用它们的任何线索?依赖设置如下:

  <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;
}

关于c# - Windows API 代码包 TaskDialog 缺少图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22561584/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com