ImageGear .NET v25.1 - Updated
Reordering Context Menu Items in Context Menu
User Guide > How to Work with... > Common Operations > Viewing > Viewing Using ASP.NET > [Legacy] Displaying Images Using Legacy ASP.NET > Context Menu Customization > Reordering Context Menu Items in Context Menu

The following example demonstrates the ability to change the context menu of a MouseTool and MarkType pair and assign it to all available pairs.

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.getDefaultContextMenu(null);
// get internal array for reodering
var itemArray = contextMenu.get_innerData();
 
// change the order of menu items in menu to opposite
var storeItem = itemArray[0];
itemArray[0] = itemArray[4];
itemArray[4] = storeItem;
storeItem = itemArray[1];
itemArray[1] = itemArray[3];
itemArray[3] = storeItem;
 
// set reorganized menu to control for all mouse tool and mark pairs
pageView.setContextMenu(contextMenu, null);
pageView.setContextMenu(contextMenu, ImageGear.Web.UI.MarkType.Line);
pageView.setContextMenu(contextMenu, ImageGear.Web.UI.MarkType.Polyline);
pageView.setContextMenu(contextMenu, ImageGear.Web.UI.MarkType.Rectangle);
pageView.setContextMenu(contextMenu, ImageGear.Web.UI.MarkType.Ellipse);
pageView.setContextMenu(contextMenu, ImageGear.Web.UI.MarkType.Polygon);
pageView.setContextMenu(contextMenu, ImageGear.Web.UI.MarkType.Text);