internal static void SetToolBarIcon() { var tbIcons = new toolbarIcons(); var pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons)); Marshal.StructureToPtr(tbIcons, pTbIcons, false); Marshal.FreeHGlobal(pTbIcons); }
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); }
void NppPluginNETEventbus_OnNPPN_TBMODIFICATION(SCNotification scnNotification) { 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, this.id, pTbIcons); Marshal.FreeHGlobal(pTbIcons); }