【问题标题】:Newly Created toolbar icon is not Showing in the Toolbar新创建的工具栏图标未显示在工具栏中
【发布时间】:2014-03-04 11:51:30
【问题描述】:

我想向 Notepad++ 工具栏添加一个新图标。
我试过以下代码

internal static void SetToolBarIcon()
{
    toolbarIcons tbIcons = new toolbarIcons();
    tbIcons.hToolbarBmp = tbBmp.GetHbitmap();
    IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons));
    Marshal.StructureToPtr(tbIcons, pTbIcons, false);
    Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIcons);
    Marshal.FreeHGlobal(pTbIcons);
}     

现在我的问题是我在工具栏中只看到一个黑色方块而不是图标

【问题讨论】:

  • 在 VMWare 中运行的 Windows Server 2008 R2 上的 Notepad++ 6.9.1 也有同样的问题。奇怪的是,该图标在未在具有相同 Npp 版本的 VMWare 中运行的 Windows 7 Enterprise 64 位上显示正常!我不知道这是否与 VMWare 有关
  • 找到解决这个问题的方法了吗?我现在面临同样的问题,它在 win10 上运行良好,但在 win 7 企业版上显示一个方形黑框

标签: c# plugins icons notepad++ toolbar


【解决方案1】:

记得把你的图标保存在Resources.resx

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-11
    • 2021-08-24
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多