コード例 #1
0
 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, (uint)NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[idMyDlg]._cmdID, pTbIcons);
     Marshal.FreeHGlobal(pTbIcons);
 }
コード例 #2
0
        public void AddToolbarIcon(int funcItemsIndex, toolbarIcons icon)
        {
            IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(icon));

            try {
                Marshal.StructureToPtr(icon, pTbIcons, false);
                _ = Win32.SendMessage(
                    PluginBase.nppData._nppHandle,
                    (uint)NppMsg.NPPM_ADDTOOLBARICON,
                    PluginBase._funcItems.Items[funcItemsIndex]._cmdID,
                    pTbIcons);
            } finally {
                Marshal.FreeHGlobal(pTbIcons);
            }
        }