的Windows API代码包TaskDialog其实缺少的图标 [英] Windows API Code Pack TaskDialog missing icon

查看:350
本文介绍了的Windows API代码包TaskDialog其实缺少的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的图标 TaskDialog其实缺失:





和任务栏:



我的代码是这样的:

 使用Microsoft.WindowsAPICodePack;使用Microsoft.WindowsAPICodePack.Dialogs 
;

...

TaskDialog其实TaskDialog其实=新TaskDialog其实();
taskDialog.Caption =错误;
taskDialog.InstructionText =测试错误信息。
taskDialog.Text =图标似乎缺少。
taskDialog.DetailsExpandedText =测试;
taskDialog.DetailsCollapsedLabel =扩展;
taskDialog.StandardButtons = TaskDialogStandardButtons.Ok;
taskDialog.Icon = TaskDialogStandardIcon.Error;
taskDialog.Show();



我使用的是1.1版本的的此处
任何线索,为什么他们失踪,如何启用它们?依赖关系设置如下:

 <&依赖性GT; 
< dependentAssembly>
< assemblyIdentity
型=win32的
NAME =Microsoft.Windows.Common - 控制
版=6.0.0.0
的ProcessorArchitecture =*
公钥=6595b64144ccf1df
语言=*
/>
< / dependentAssembly>
< /依赖性>


解决方案

我已经找到了解决办法了这一点。 。显然,这是API本身中的错误

  taskDialog.Opened + =新的EventHandler(taskDialog_Opened); 

...

公共无效taskDialog_Opened(对象发件人,EventArgs五)
{
TaskDialog其实TaskDialog其实=发件人为TaskDialog其实;
taskDialog.Icon = taskDialog.Icon;
taskDialog.FooterIcon = taskDialog.FooterIcon;
taskDialog.InstructionText = taskDialog.InstructionText;
}


The icons in my TaskDialog are missing:

And in the taskbar:

My code is this:

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

I'm using version 1.1 from here. Any clue why they are missing and how to enable them? Dependencies are set as following:

  <dependency>
    <dependentAssembly>
      <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls"
      version="6.0.0.0"
      processorArchitecture="*"
      publicKeyToken="6595b64144ccf1df"
      language="*"
/>
    </dependentAssembly>
  </dependency>

解决方案

I've found a workaround to this. Apparently it is a bug in the API itself.

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

这篇关于的Windows API代码包TaskDialog其实缺少的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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