About the Creating toolbar menus that work with the ToolbarControl Sample
[C#]
NavigationMenu.cs
using System;
using ESRI.ArcGIS.SystemUI;
namespace ToolbarMenu
{
/// <summary>
/// Summary description for NavigationMenu.
/// </summary>
public class NavigationMenu : IMenuDef
{
public NavigationMenu()
{
//
// TODO: Add constructor logic here
//
}
public void GetItemInfo(int pos, IItemDef itemDef)
{
//Commands for the menu - the object browser lists these commands
switch (pos)
{
case 0:
itemDef.ID = "esriControls.ControlsMapZoomInFixedCommand";
break;
case 1:
itemDef.ID = "esriControls.ControlsMapZoomOutFixedCommand";
break;
case 2:
itemDef.ID = "esriControls.ControlsMapFullExtentCommand";
itemDef.Group = true;
break;
case 3:
itemDef.ID = "esriControls.ControlsMapZoomToLastExtentBackCommand";
break;
case 4:
itemDef.ID = "esriControls.ControlsMapZoomToLastExtentForwardCommand";
break;
}
}
public string Caption
{
get
{
return "Navigation";
}
}
public int ItemCount
{
get
{
return 5;
}
}
public string Name
{
get
{
return "Navigation";
}
}
}
}
[Visual Basic .NET]
NavigationMenu.vb
Option Strict Off
Option Explicit On
Friend Class NavigationMenu
Implements ESRI.ArcGIS.SystemUI.IMenuDef
Private ReadOnly Property IMenuDef_Caption() As String Implements ESRI.ArcGIS.SystemUI.IMenuDef.Caption
Get
Return "Navigation"
End Get
End Property
Private ReadOnly Property IMenuDef_ItemCount() As Integer Implements ESRI.ArcGIS.SystemUI.IMenuDef.ItemCount
Get
Return 5
End Get
End Property
Private ReadOnly Property IMenuDef_Name() As String Implements ESRI.ArcGIS.SystemUI.IMenuDef.Name
Get
Return "Navigation"
End Get
End Property
Private Sub IMenuDef_GetItemInfo(ByVal pos As Integer, ByVal itemDef As ESRI.ArcGIS.SystemUI.IItemDef) Implements ESRI.ArcGIS.SystemUI.IMenuDef.GetItemInfo
Select Case pos 'Commands for the menu - the object browser lists these commands
Case 0
itemDef.ID = "esriControls.ControlsMapZoomInFixedCommand"
Case 1
itemDef.ID = "esriControls.ControlsMapZoomOutFixedCommand"
Case 2
itemDef.ID = "esriControls.ControlsMapFullExtentCommand"
itemDef.Group = True
Case 3
itemDef.ID = "esriControls.ControlsMapZoomToLastExtentBackCommand"
Case 4
itemDef.ID = "esriControls.ControlsMapZoomToLastExtentForwardCommand"
End Select
End Sub
End Class