Exemple #1
0
        internal static void SetToolBarIcon()
        {
            toolbarIcons tbIcons = new toolbarIcons();

            tbIcons.hToolbarBmp = playButton.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[0]._cmdID, pTbIcons);
            Marshal.FreeHGlobal(pTbIcons);
        }
Exemple #2
0
        /// <summary>
        /// Send message to Npp to add command to toolbar.
        /// </summary>
        /// <param name="toolbarButtonBmp">Bitmap for toolbar icon.</param>
        /// <param name="commandId">Index of plugin command.</param>
        private static void AddNppToolbarIcon(Bitmap toolbarButtonBmp, int commandId)
        {
            toolbarIcons tbIcons = new toolbarIcons
            {
                hToolbarBmp = toolbarButtonBmp.GetHbitmap()
            };
            IntPtr pTbIcons = GetStructPointer(tbIcons);

            Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[commandId]._cmdID, pTbIcons);
            Marshal.FreeHGlobal(pTbIcons);
        }
Exemple #3
0
        /// <summary>
        /// Provides the icons in the Notepad++ toolbar
        /// </summary>
        internal static void SetToolBarIcon()
        {
            // Icon for the print button
            toolbarIcons tbIcons = new toolbarIcons()
            {
                // Get the handle from the Format resource object
                hToolbarBmp = NppFormatPlugin.Properties.Resources.Format.GetHbitmap()
            };

            // Allocate the resources in the none .NET world of Notepad++
            IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons));

            Marshal.StructureToPtr(tbIcons, pTbIcons, false);

            // Send a system message to Npp to set add a toolbar icon.
            Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[menuId_Format]._cmdID, pTbIcons);
            Marshal.FreeHGlobal(pTbIcons);
        }