ImageGear for .NET User Guide > Using ImageGear for .NET > Using ImageGear.Web.UI Namespace > Context Menu Customization > Changing the Text of Context Menu Items |
Every context menu item other than a separator has text. The following example demonstrates renaming or localizing the text within the context menu associated with the hand pan mouse tool and image click.
For Ajax server users, please comment out the first portion of the code below and uncomment the second. |
Example |
Copy Code |
---|---|
// get PageView control with "pluginPageView" identifier from the HTML page in jQuery plugin var pageView = $("#pluginPageView").ImGearPageViewPlugin(); // get PageView control with "pluginPageView" identifier from the HTML page for Ajax server // var pageView = $.find("pluginPageView"); // get context menu for None mouse tool and no mark clicked conditions var contextMenu = pageView.getContextMenu(null, ImageGear.Web.UI.MouseTool.HandPan); // change "Zoom In 25%" to "Decrease Size" contextMenu.get(0).text = 'Increase Size'; // change "Zoom Out 25%" to "Decrease Size" contextMenu.get(1).text = 'Decrease Size'; // change "Zoom To Fit" to "Align Size" contextMenu.get(2).text = 'Align Size'; // change "Mouse Tools" to "Mouse Modes" contextMenu.get(4).text = 'Mouse Modes'; // set reorganized menu to back pageView.setContextMenuForTool(contextMenu, null, ImageGear.Web.UI.MouseTool.HandPan); |