c# - IE9 工具栏按钮的自定义图标

标签 c# internet-explorer bho browser-extension protected-mode

我为 IE9 做了一个扩展,添加了一个工具栏按钮。

注册看起来像这样:

RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegCmd, true);
if (registryKey == null)
   registryKey = Registry.LocalMachine.CreateSubKey(RegCmd);
RegistryKey key = registryKey.OpenSubKey(guid);
if (key == null)
  key = registryKey.CreateSubKey(guid);
key.SetValue("ButtonText", "My Button");
key.SetValue("CLSID", "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}");
key.SetValue("ClsidExtension", guid);
key.SetValue("Icon", "c:\myicon.ico");
key.SetValue("HotIcon", "c:\myicon.ico");
key.SetValue("Default Visible", "Yes");
key.SetValue("MenuText", "My Button");
key.SetValue("ToolTip", "My Button");
//key.SetValue("KeyPath", "no"); 
registryKey.Close();
key.Close();

问题是——图标在文件系统上被引用为文件,而不是 URL。 IE Gallery 将插件分发为 .dll 而不是 .msi,所以我没有机会将我的 .ico 放到本地文件系统上。

如何让按钮使用我的图标?

最佳答案

您应该能够将图标添加到 DLL 并使用 mydll.dll,0 或与图标类似的东西。

关于c# - IE9 工具栏按钮的自定义图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10036424/

相关文章:

multithreading - COM:从其他线程调用导致崩溃,如何让它在同一个线程上运行?

c# - 更改所有字符串属性最大长度

C# Datareader 到 DTO?

c# - 如何将 ProjectTo 从基本类型转换为仅在运行时已知的类型?

c++ - BHO 和 Internet Explorer 11

c# - 找不到 IObjectWithSite 的程序集

c# - 删除 List<T> 中的备用元素

internet-explorer - ie的盒子阴影发光效果

html - 为什么这个 div 的宽度在 IE7 中横跨整个页面?

javascript - html2canvas.js 无法在 IE9/10/11 中工作