c# – 在Taskdialog中使用隐藏的安全图标

c# – 在Taskdialog中使用隐藏的安全图标,第1张

概述我试图在TaskDialog消息框中显示安全成功图标(带蓝色背景).这不是TaskDialogStandardIcon的枚举值之一.参考: http://dotnet.dzone.com/articles/using-new-taskdialog-winapi. 如何将这些非标准值分配给((TaskDialog)发送者).Icon?它甚至可以在C#中使用吗? C# 任何指针都会非常有用. 问候, 我试图在TaskDialog消息框中显示安全成功图标(带蓝色背景).这不是TaskDialogStandardIcon的枚举值之一.参考: http://dotnet.dzone.com/articles/using-new-taskdialog-winapi.

如何将这些非标准值分配给((TaskDialog)发送者).Icon?它甚至可以在C#中使用吗? C#

任何指针都会非常有用.

问候,
阿什温

解决方法 我想你需要自己从comctl32.dll导入 TaskDialog函数:

static class TaskDialogWrapper{    [Dllimport("comctl32.dll",CharSet = CharSet.Unicode,EntryPoint = "TaskDialog")]    static extern int TaskDialog(IntPtr hWnd,IntPtr hInstance,string pszWindowTitle,string pszMainInstruction,string pszContent,TaskDialogCommonbutton DWCommonbuttons,IntPtr pszIcon,out IntPtr pnbutton);    public static TaskDialogCommonbutton Show(IntPtr handle,IntPtr instance,string Title,string instructionText,string content,TaskDialogCommonbutton commonbuttons,TaskDialogCommonIcon commonIcon)    {        IntPtr resultbutton;        if (TaskDialog(handle,instance,Title,instructionText,content,commonbuttons,new IntPtr((int)commonIcon),out resultbutton) != 0)            throw new InvalIDOperationException();        return (TaskDialogCommonbutton)resultbutton;    }}[Flags()]enum TaskDialogCommonbutton{    Ok = 0x1,Yes = 0x2,No = 0x4,Cancel = 0x8,Retry = 0x10,Close = 0x20}enum TaskDialogCommonIcon{    ShIEldGrey = 65527,ShIEldOk = 65528,ShIEldError = 65529,ShIElDWarning = 65530,ShIEldBlue = 65531,ShIEld = 65532,information = 65533,Error = 65534,Warning = 65535,}

要从文件中使用您自己的图标,您需要导入TaskDialogIndirect.

(顺便说一下,我为TaskDialogCommonIcon找到了许多其他有趣的图标样式.你可以添加例如:

enum TaskDialogCommonIcon{    None = 0,Sheet = 2,ExplorerFolderOpen = 3,ExplorerFolderFlat = 5,ExplorerFolderleft = 6,Search = 8,ExplorerFolderClosed = 10,ExplorerGames = 14,Application = 15,transparentSpace = 17,ExplorerSearch = 18,Textfile = 19,Letter = 20,Picture = 21,Diashow = 103,// ...}
总结

以上是内存溢出为你收集整理的c# – 在Taskdialog中使用隐藏的安全图标全部内容,希望文章能够帮你解决c# – 在Taskdialog中使用隐藏的安全图标所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1218794.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存