Application.AddUserMenuItem2 Method

This method allows you to add custom menu items to the HotDocs library menus. For example, you can add an item to the HotDocs Help menu to display your own "About" dialog box. When a user selects the item from the menu, the OnUserMenuItemClickedEvent event is fired to notify your application that the menu item was chosen.

The AddUserMenuItem method is very similar and performs the same basic task as this method. However, the AddUserMenuItem method does not allow you to specify the position of the item in the menu or the icon that appears next to the item.

This method was introduced with the release of HotDocs 2005.

Syntax

int AddUserMenuItem2 ( string menuTxt, HotDocs.HDLIMENU menu, int position, Icon Icon )

Parameters Description
menuTxt The text to be inserted into the menu. To insert a separator bar in the menu, use a single hyphen (-).
menu The name of the HotDocs menu to which the menu item will be added. This must be a member of the HDLIMENU enumeration.
position

This is the position in the menu where the custom menu item will be added.

Icon

This is the icon that appears next to the item in the menu.

Return Value

A menu handle used to track when a user clicks the custom menu item.

This method only manipulates the menus in the HotDocs library window. To add items to the menus in the assembly window, see the Assembly.AddUserMenuItem method. You can also create HotDocs plug-ins that further customize menus in the library window.

Example

The following Visual C# example adds a menu item to the File menu in the HotDocs library window with your chosen icon. This example can only be used in conjunction with a Plugin:

public class ExampleCode
{
    static void Main()
    {
        HotDocs.Application app = new HotDocs.Application();
         
        //Important: HotDocs.Icon can only be used in conjunction with a Plugin.
        HotDocs.Icon icon = new HotDocs.Icon();
        icon.LoadIcon(@"C:\images\UserMenuIcon.ico");
        app.AddUserMenuItem2("User Menu Entry #1", HDLIMENU.LI_FILE, 5, icon);
         
        Marshal.ReleaseComObject(icon);
        Marshal.ReleaseComObject(app); 
    }
}