c# – 在Taskdialog中使用隐藏的安全图标
发布时间:2020-12-16 01:59:56 所属栏目:百科 来源:网络整理
导读:我试图在TaskDialog消息框中显示安全成功图标(带蓝色背景).这不是TaskDialogStandardIcon的枚举值之一.参考: http://dotnet.dzone.com/articles/using-new-taskdialog-winapi. 如何将这些非标准值分配给((TaskDialog)发送者).Icon?它甚至可以在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,} 要从文件中使用您自己的图标,您需要导入 (顺便说一下,我为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,// ... } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |